use whiteread::parse_line;

fn main() {
    let mut time: Vec<u32> = Vec::new();
    let mut ans: u32 = 0;
    for _ in 0..5 {
        time.push(parse_line().unwrap());
    }
    time.sort_by_key(|x| x % 10);
    for &t in &time {
        if t % 10 == 0 {
            ans += t;
        } else {
            ans += (t / 10 + 1) * 10;
        }
    }
    let idx = time.iter().position(|&x| x % 10 != 0).unwrap();
    println!("{}", ans - (10 - time[idx] % 10));
}
