use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let mut sum: i32 = 0;
    let mut min: i32 = 9;
    for _i in 0..5{
	let menu: i32 = read();
	if min > menu%10 && menu%10 != 0{
	    min = menu%10;
	}
	if menu%10==0{
	    sum += menu;
	}else {
	    sum += (menu/10+1)*10;
	}
    }
    println!("{}",sum-10+min);
}
