use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let mut dishes: Vec<i32> = Vec::new();

    for _ in 0..5{
        dishes.push(read_as_vec()[0]);
    }
    //println!("{:?}", dishes);
    dishes.sort_by_key(|x| {
        if *x%10 == 0{
            return -10;
        }else{
            return -*x%10;
        }
    });
    //println!("{:?}", dishes);
    let last = ((dishes[4]/10)+1)*10 - dishes[4];
    println!("{}",dishes.iter().map(|x| (((*x-1)/10)+1)*10).sum::<i32>() - last);
}
