import strscans let (_, a, b, c, d, e) = stdin.readAll.scanTuple"$i $i $i $i $i" var pt, cal, ans: int for x in 0..c: pt = a + x * d cal = b + x * e ans = max(ans, pt - cal) echo ans