fn main() { let mut ab = String::new(); std::io::stdin().read_line(&mut ab).ok(); let ab: Vec = ab.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let a = ab[0] % 12; let b = ab[1] % 60; let orgb = b; let a = b as f64 / 2. + a as f64 * 30.; let b = b as f64 * 6.; if a == b { println!("0"); return; } let start = if b > a { (60 - orgb) * 60 } else { 0 }; let b = if start > 0 { b - 360. } else { b }; for i in start..7200 { let i = i as f64; let ni = i + 1.; let prev_a = a + i / 120.; let prev_b = b + i * 6. / 60.; let next_a = a + ni * 30. / 3600.; let next_b = b + ni * 6. / 60.; if next_a == next_b { println!("{}", ni as usize); return; } if prev_b < prev_a && next_a < next_b { println!("{}", i as usize); return; } } }