LKP '18 Contest 1 P2 - Observing Frogs

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 0.1s
Java 0.3s
Memory limit: 16M

Author:
Problem type

Lyestria is observing a group of N frogs. The frogs are numbered from 1 to N.

The frog numbered i conveniently lives at the point i. On this day, the frog numbered i wants to go to the point Ni+1, where all the points are equally spaced.

Lyestria then asks you to compute the sum of the distances each frog must travel to get to their desired location.

Constraints

1N109

Input Specification

The first line contains one integer, N, the number of frogs.

Output Specification

On one line, output one integer, the sum of the distances each frog must travel to get home.

Sample Input 1

Copy
4

Sample Output 1

Copy
8

Sample Input 2

Copy
5

Sample Output 2

Copy
12

Comments

There are no comments at the moment.