Skip to content

Instantly share code, notes, and snippets.

@VitamintK
Created February 23, 2016 05:22
Show Gist options
  • Save VitamintK/9a8c19f5f4fd624bc86a to your computer and use it in GitHub Desktop.
Save VitamintK/9a8c19f5f4fd624bc86a to your computer and use it in GitHub Desktop.
n, m, s, x, y, z = map(int, input().split())
cost = x + y + z
import math
comps = math.ceil(s/n)
if comps * cost <= m:
print(m - comps*cost)
else :
print( m%(comps*cost))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment