Toyota quarterly profit rises to $3.17 billion