#![allow(non_snake_case, unused_imports)]
//////////////////////////////// LIBRARY START ////////////////////////////////
#[macro_use]
pub mod contest {
    #[macro_use]
    pub mod io {
        /// Scanner
        ///
        /// # Example
        /// ```
        /// use contest::io::Scanner;
        /// let mut sc = Scanner::new("1 2 \n\n \r\t \n 3".as_bytes());
        /// assert_eq!("1".to_string(), sc.next::<String>());
        /// let v = sc.nexts(2);
        /// assert_eq!(2i32, v[0]);
        /// assert_eq!(3i32, v[1]);
        ///
        /// // To create a scanner from stdin:
        /// Scanner::new(std::io::stdin());
        /// ```
        use std;
        use std::io;
        use std::io::BufRead;

        use super::prelude::*;

        pub struct Scanner<R: io::Read> {
            br: io::BufReader<R>,
            // Read tokens are stored in reversed order per line.
            buf: Vec<String>,
        }

        pub fn new<R: io::Read>(r: R) -> Scanner<R> {
            Scanner::new(r)
        }

        impl<R: io::Read> Scanner<R> {
            #[inline]
            pub fn new(r: R) -> Scanner<R> {
                Scanner {
                    br: io::BufReader::new(r),
                    buf: vec![],
                }
            }
            #[inline]
            pub fn next<T>(&mut self) -> T
            where
                T: std::str::FromStr,
                T::Err: std::fmt::Debug,
            {
                self.next_string()
                    .map(|s| s.parse::<T>().expect("Parse failed: "))
                    .expect("Unexpected EOF")
            }
            #[inline]
            pub fn nexts<T>(&mut self, n: i32) -> MyVec<T>
            where
                T: std::str::FromStr,
                T::Err: std::fmt::Debug,
            {
                let mut res = v![];
                for _ in 0..n {
                    res.push(self.next());
                }
                res
            }
            fn next_string(&mut self) -> Option<String> {
                self.buf.pop().or_else(|| match self.update() {
                    true => self.next_string(),
                    false => None,
                })
            }
            #[inline]
            fn update(&mut self) -> bool {
                let mut s = String::new();
                let res = self.br.read_line(&mut s);
                match res.expect("I/O error.") {
                    0 => false,
                    _ => {
                        self.buf = s.split_whitespace().map(|x| x.to_string()).rev().collect();
                        true
                    }
                }
            }
        }

        #[test]
        fn test_next() {
            let mut sc = new("hoge".as_bytes());
            let s: String = sc.next();
            assert_eq!("hoge", s);
        }
    }
    #[macro_use]
    pub mod prelude {
        //! Items most contest code will use.

        pub use self::myvec::MyVec;
        pub use self::primitive::ToUsize;

        #[macro_use]
        pub mod myvec;
        pub mod primitive;
    }
}
//////////////////////////////// LIBRARY END ////////////////////////////////
#[macro_use]
use contest::io::Scanner;
use contest::prelude;

fn main() {
    let mut sc = Scanner::new(std::io::stdin());
    let a = sc.nexts::<i32>(5);
    let mut min_one = 10;
    let mut res = 0;
    for i in &*a {
        if i % 10 > 0 {
            min_one = std::cmp::min(min_one, i % 10);
        }
        res += (i + 9) / 10 * 10;
    }
    if min_one < 10 {
        res -= 10 - min_one;
    }
    println!("{}", res);
}
