Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c, x, y, z, m, s, f, e, t = map(int, input().split())
- t1, x1 = 0, 0
- t2, x2 = 0, 0
- e += 1
- while e > 0:
- t1 += m
- kol_g = s + x1
- x1 = 0
- e -= (kol_g // f)
- x1 = kol_g % f
- if x1 > x:
- x1 = x
- t1 += t
- while c > x:
- t2 += m
- kol_g = s + x2
- x2 = 0
- if ((kol_g // y) * z) + x > c:
- if (c - x) % z != 0:
- x2 += (kol_g - (((((c - x) // z) * z + z) // z) * y))
- x += (((c - x) // z) * z + z)
- else:
- x2 += (kol_g - (((c - x) // z) * y))
- x += (c - x)
- else:
- x += ((kol_g // y) * z)
- x2 += (kol_g % y)
- if x2 > x:
- x2 = x
- if (c - x2) % s != 0:
- t2 += ((((c - x2) // s) + 1) * m)
- else:
- t2 += (((c - x2) // s) * m)
- print(min([t1, t2]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement