#include using namespace std; long long MX(long long A,long long B){ if (A> A >> B >> N >> M; X = MN(A,B)+(B-MN(A,B))/(M+1); Y = MN(A,B)+(A-MN(A,B))/(N+1); cout << MX(X,Y) << endl; }