a, b, c, d = map(int, input().split()) print(min(a, b//c, (1+c)*d))