Problem :

https://www.hackerrank.com/challenges/halloween-sale/problem


My Solution :

#!/usr/bin/env python3


def how_many_games(p, d, m, s):
    count = 0
    while p <= s:
        s -= p
        p = max(m, p-d)
        count += 1
    return count


p, d, m, s = map(int, input().split())
answer = how_many_games(p, d, m, s)
print(answer)