/* -*- coding: utf-8 -*- * * 1446.cc: No.1446 ハンバーグと納豆ごはん - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { ll a, b, n, m; scanf("%lld%lld%lld%lld", &a, &b, &n, &m); ll c = min(a, b); a -= c, b -= c; c += a / (n + 1) + b / (m + 1); printf("%lld\n", c); return 0; }