use std::io::*;
use std::str::FromStr;
use std::num::*;
use std::vec::*;

fn main() {
    let mut a: i32 = read();
    let mut b: i32 = read();
    let mut c: i32 = read();
    let mut d: i32 = read();
    let mut e: i32 = read();
    let mut x:Vec<i32> = [a,b,c,d,e].to_vec();
    let mut y:Vec<i32> = [a,b,c,d,e].to_vec();
    let mut x2:Vec<i32> = x.into_iter().map(|x| x%10).filter(|&x| x!=0).collect::<Vec<i32>>();
    x2.sort();
    let mut ans: i32 = 0;
    let mut flag: i32 = 0;
    for i in 0..5 {
        if flag==0 && y[i as usize]%10==x2[0] {
            ans+=y[i as usize];
            flag=1;

        }else{
            ans+=((y[i as usize]+9) / 10)*10;
        }
    }
    println!("{}", ans);
}
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}