// https://omegaup.com/arena/problem/Repartiendo-cachorros 
#include <stdio.h> 
 
int main( ) { 
   int c, p, h; 
   scanf("%d%d%d", &c, &p, &h); 
   int sobran = (c - p) % (h + 1); 
   printf("%d", p + sobran); 
   return 0; 
}