solution

制約を式に直すと答えtNA+Xt=S+Y(Kt)0tK。解くだけ。O(1)

implementation

#!/usr/bin/env python3
import random
a, s, k, x, y = map(int, input().split())
num = s - a + k * y
den = x + y
result = -1
if num % den == 0 and 0 <= num // den <= k:
    result = num // den
print(result)