fn main() { let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: Vec = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut n = temp[0]; let m = temp[1]; let p = temp[2]-1; let q = temp[3]-1; let mut result = 0usize; while n > 0 { if p <= result % 12 && result % 12 <= p+q { n -= (m*2).min(n); } else { n -= m.min(n); } result += 1; } println!("{}", result); }