use std::io::{self, BufRead}; fn exchange(a: i32, mut y: i32) -> (i32, i32) { if y < a { return (0, y); } let mut results = (0, 0); loop { if y < a { results.1 += y; return results; } else { y = y - a; results.0 += 1; } } } fn main() { let stdin = io::stdin(); let mut line = stdin.lock().lines(); let mut l: i32 = line.next().unwrap().unwrap().parse().unwrap(); let mut m: i32 = line.next().unwrap().unwrap().parse().unwrap(); let mut n: i32 = line.next().unwrap().unwrap().parse().unwrap(); let mut result = 0; loop { if l < 10 && m < 4 && n < 25 { result += m + n + l; break; } if l != 0 && l >= 10 { let a = exchange(10, l); l = a.1; } if m != 0 && m >= 4 { let a = exchange(4, m); l += a.0; m = a.1 } if n != 0 && n >= 25 { let a = exchange(25, m); l += a.0; n = a.1; } } println!("{}", result); }