import java.util.Scanner object Main extends App { val sc = new Scanner(System.in) val n, m, p, q = sc.nextInt val consumed = (1 to 12).map(i => if (i >= p && i < p + q) (2 * m) else (m)).toArray var nn = n var cnt = 0; while (nn > 0) { nn -= consumed(cnt % 12) cnt += 1 } println(cnt) }