e-olymp
Competitions

Azərbaycan Respublika Olimpiadasının yarımfinalı 2019-2020

Dino and snow buildings

Dino travels to China (the Coronavirus was not yet spread there) and sees 109 buildings there. The height of the first building is 1, the second building has the height 1 + 2, the third one is 1 + 2 + 3, etc. The height of the last building is 1 + 2 + 3 + ... + 109 (all heights are given in meters).

After a day, Dino fell asleep and saw an interesting view in the morning: it snowed at night and the height of all buildings increased equally! Dino wants to know how many meters of snow fell. To do this, he went to two neighbouring buildings (for example, 3 - d and 4 - th) and measured their new heights. Determine how many meters of snow fell if the heights of these buildings equal to a and b meters respectively.

Input

Two integers a and b (ab). It is known that the correct answer always exists, and the height of the fallen snow is no more than 109 meters.

Output

Print the height of the fallen snow.

Time limit 1 second
Memory limit 128 MiB
Input example #1
11 16
Output example #1
1
Source Semifinals, Azerbaijan Olympiad 2018-2019