program main
 implicit none
 integer(8) N, A, B
 integer(8) :: syoN, amrN
 integer(8) :: ao=0
 integer(8) i,ii

 read *, N, A, B

 if (A==0) goto 100

 syoN=N/(a+b)
 amrN=mod(N,(a+b))

 ao=ao+syoN*A

 if (amrN>A)  ao=ao+A
 if (amrN<=A) ao=ao+amrN

100 continue
 print '(i0)', ao

endprogram main
