# -*- coding: utf-8 -*- from sys import stdin n, m, p, q = [int(x) for x in stdin.readline().rstrip().split()] cal = [int(0) for i in range(12)] for i in range(p-1, p-1+q): cal[i] += 1 year = n // (m * (12+q)) ans = 12 * year nokori = n % (m * (12+q)) for i in range(12): if cal[i]: nokori -= 2*m else: nokori -= m ans += 1 if nokori <= 0: break print(ans)