#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let mut v = Vec::new();
    for _ in 0..5 {
        let tmp = get!(i32);
        v.push(tmp);
    }
    let mut time = 0;
    let mut rest = Vec::new();
    let mut hitoketa = 9;
    let mut min = -1;
    for i in 0..5 {
        if v[i] % 10 == 0 {
            time += v[i];
        } else {
            let t_hitoketa = v[i] % 10;
            if t_hitoketa < hitoketa {
                hitoketa = t_hitoketa;
                min = v[i];
            }
            rest.push(v[i]);
        }
    }
    time += min;
    for i in 0..rest.len() {
        if rest[i] == min {
            rest.remove(i);
            break;
        }
    }
    for i in 0..rest.len() {
        time += ((rest[i] + 9) / 10) * 10;
    }
    println!("{}", time);
}
