fn main() { let mut input = String::new(); let _ = std::io::stdin().read_line(&mut input); let input: Vec = input.trim().split_whitespace().map(|n| n.parse().unwrap()).collect(); let m = (input[0] - 1) * input[3]; let hour = m / 60; let minute = m % 60; let mut hour = input[1] + hour; let mut minute = input[2] + minute; if minute >= 60 { hour += minute / 60; minute = minute % 60; } if hour >= 24 { hour = hour % 24; } println!("{}", hour); println!("{}", minute); }