A,B,C,D = map(int,input().split()) print(min([int(B/C)+int(B/C)*C,D]))