//https://ncode.syosetu.com/n4830bu/281/ #include using namespace std; using ll = long long; int main() { ll d; vector H(3); cin >> d; for (auto&& h : H) { cin >> h; } auto book = [&](ll height, ll threshold) { if (threshold == 0) return (ll)1e11; if (height < threshold) return 0ll; return (height - threshold + d) / d; }; ll maine = min(book(H[0], H[1]) + book(H[2], H[1]), book(H[1], H[0]) + book(H[1], H[2])); cout << (maine > 1e10 ? -1 : maine) << endl; }