#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:[isize;5],
    }
    let mut z =110;
    let mut ans =0;
    for i in 0..5 {
        ans+=(a[i]+9)/10*10;
        if z>a[i]%10&&a[i]%10!=0 {z=a[i]%10;}
    }
    println!("{}",ans+z-10)
}