先算出完成时间,再加上溢出时间
#include<bits/stdc++.h>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int a,b,n,l,r;
scanf("%d%d%d",&n,&a,&b);
l=0,r=50000000;
for (int mid=l+r>>1;l<r;mid=l+r>>1) if (mid/a+mid/b>=n) r=mid;
else l=mid+1;
int sola=l/a,solb=l/b;
if (sola*a<l) l=(sola+1)*a,sola++;
else if (solb*b<l) l=(solb+1)*b,solb++;
printf("%d %d\n",sola+solb,l);
}