#include #include #include int main() { int d = 0; long int left = 0; long int center = 0; long int right = 0; char str[20]; long int count = 0; gets(str); d = atoi(str); gets(str); left = atoi(str); gets(str); center = atoi(str); gets(str); right = atoi(str); if (d == 0) { count = -1; printf("%ld", count); return 0; } if (!((center < left && center < right) || (center > left && center > right))) { long int lc = left - center; long int rc = right - center; long int l = abs(lc) / d; long int r = abs(rc) / d; if (l > r) { if (right != 0) count = r + 1; else count = l + 1; } else { if (left != 0) count = l + 1; else count = r + 1; } } if ((left == 0 && center == 0) || (right == 0 && center == 0)) count = -1; if((left == center) || (center == right) || (left == right)) center = -1; printf("%ld", count); return 0; }