let v = readLine()!.split(separator: " ").map { Int($0)! } let (a, b, c, d, e) = (v[0], v[1], v[2], v[3], v[4]) var result = [Int]() for bacon in 0...c { result.append((a + bacon * d) - (b + bacon * e)) } print(result.max()!)