#include int main(){ int n,i; long x,y,d,dmax=0,ans=0; scanf("%d",&n); for(i=0;iy)?x:y; if(d>dmax*2){ ans+=(d-dmax-1)/dmax; d-=dmax*ans; } printf("%ld\n",ans+((d==dmax)?1:2)); return 0; }