import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
{
final double e = 10e-8;
Scanner in
= new Scanner
(System.
in); double x1, y1, x2, y2;
x1=in.nextDouble();
y1=in.nextDouble();
x2=in.nextDouble();
y2=in.nextDouble();
double d, a, b;
d
= Math.
abs((y2
* x1
- x2
* y1
) / Math.
sqrt((x1
- x2
) * (x1
- x2
) + (y1
- y2
) * (y1
- y2
))); //Растояние до точки на отрезке, ближайщей к началу координат
a
= Math.
sqrt(x1
* x1
+ y1
* y1
); //Растояние от начала координат до первой точки
b
= Math.
sqrt(x2
* x2
+ y2
* y2
); //Растояние от начала координат до второй точки
int count = 0;
if ((2 * x1 * x1 - 2 * x1 * x2 + 2 * y1 * y1 - 2 * y1 * y2 < 0) | (2 * x2 * x2 - 2 * x1 * x2 + 2 * y2 * y2 - 2 * y1 * y2 < 0))
//проверка первого условия
count
= (int)(Math.
max(a, b
) + e
) - (int)(Math.
min(a, b
) - e
); else {
//второе условие
count = (int)(a + e) - (int)(d - e);
count = count + (int)(b + e) - (int)(d - e);
if ((Math.
abs(Math.
round(d
) - d
) < e
) & (Math.
abs(d
) > e
)) { //проверка крайнего случая
count--;
}
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewogICAgCWZpbmFsIGRvdWJsZSBlID0gMTBlLTg7CiAgICAJU2Nhbm5lciBpbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgICAJZG91YmxlIHgxLCB5MSwgeDIsIHkyOwogICAgCXgxPWluLm5leHREb3VibGUoKTsKICAgIAl5MT1pbi5uZXh0RG91YmxlKCk7CiAgICAJeDI9aW4ubmV4dERvdWJsZSgpOwogICAgCXkyPWluLm5leHREb3VibGUoK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Qu9C+0LLQuNC1CiAgICAgICAgCWNvdW50ID0gKGludCkoYSArIGUpIC0gKGludCkoZCAtIGUpOwogICAgICAgIAljb3VudCA9IGNvdW50ICsgKGludCkoYiArIGUpIC0gKGludCkoZCAtIGUpOwogICAgICAgIAlpZiAoKE1hdGguYWJzKE1hdGgucm91bmQoZCkgLSBkKSA8IGUpICYgKE1hdGguYWJzKGQpID4gZSkpIHsKICAgICAgICAgICAgCS8v0L/RgNC+0LLQtdGA0LrQsCDQutGA0LDQudC90LXQs9C+INGB0LvRg9GH0LDRjwogICAgICAgICAgICAJY291bnQtLTsKICAgICAgICAJfQogICAgCX0KICAgIAlTeXN0ZW0ub3V0LnByaW50KGNvdW50KTsKCX0KfQ==