Yo`nalishlar
Hozirda online

Statistika

Masalalar soni: 909

Foydalanuvchilar soni: 8819

Jo'natishlar soni: 714352

Muhokama yozuvlari: 4541

Yangiliklar soni: 97

Yangiliklar izohlari: 1174


So'ngi izohlar

730. The Segment
Vaqt limiti: 1 sekund
Xotira limiti: 64 MB

The ends of the segment have integer coordinates. Find the number of points on segment with integer coordinates.

Описание: prb136














Input

Four numbers - the coordinates x1, y1, x2, y2 of the segment ends. All input numbers are not greater than 109 by the absolute value. The ends do not coincide.

Output

The required number of points.

Samples

Input

Output

1

0 0 3 3

4

2

1 1 2 3

2

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com
Mening urinishlarim(0) Muhokama (0) Jo'natish Eng yaxshi yechimlar Barcha muvaffaqiyatli urinishlar(42) Barcha urinishlar(120)