All problems

Annotating Both a Value and Its Change

hardPythonMatplotlibAnnotations

Harbourline Retail's weekly trading line is charted for the regional call, and the final point is labelled with two things: where the number ended up, and how much it moved in that last week. Readers who get only the level ask "is that good?", and readers who get only the move ask "good compared with what?", so the label carries both. The call notes take the same two figures.

Task: Print the final reading and the size of the last step.

Input

The first line holds one integer n, the number of readings in time order, and n is at least 2. Each of the next n lines holds one reading, a number on its own.

Output

Two lines, each with exactly one decimal place. The first is the last reading. The second is the last reading measured against the one immediately before it, so a fall prints with a minus sign and a rise prints with no sign at all.

Example:

Input:
3
10
20
35

Output:
35.0
15.0

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…