fn main() {
    let a: [i32; 5] = {
        [
            read(),
            read(),
            read(),
            read(),
            read(),
        ]
    };

    let mut ans = 0;

    let mut v: Vec<i32> = a.into_iter()
    .map(|x| {
        let d = x / 10;
        ans += d * 10;
        x % 10
    })
    .filter(|&x| x != 0)
    .collect();

    v.sort();

    ans += v[0] + 10 * (v.len() as i32 - 1);

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}