Олимпиадный тренинг

Задача 37012. Grasshoppers


Задача

Темы: Циклы

Two grasshoppers are sitting on a straight path at a distance of 1 meter from each other. From time to time one of the grasshoppers jumps a few centimeters to the left or right. It is required to find out what was the minimum distance that the grasshoppers approached in the process of jumping. (The distance is considered only in those moments when both grasshoppers are sitting on the ground).

Input: The first line contains a single number N (1 <= N <= 100) – the total number of jumps followed by N numbers describing the jumps. The modulus of the number is equal to the length of the jump in centimeters; the number is negative if the grasshopper started this jump towards another grasshopper, and positive – if from another grasshopper. The modulo numbers do not exceed 100 and all are different from 0. (Grasshoppers can jump over each other. Grasshoppers are guaranteed not to land on top of each other.)

Output: You need to output one number – the minimum distance in centimeters that grasshoppers approached.

Examples
# Input Output
1 5
1
2
3
4
5
100