// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/rope>
// #include <type_traits>
using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)

#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(xs) ((int)(xs).size())
#define all(xs) xs.begin(),xs.end()
#define lla(xs) xs.rbegin(),xs.rend()
#define sum(xs) accumulate(all(xs), 0)
#define sortup(xs) sort(all(xs))
#define sortdown(xs) sort(lla(xs))
#define reverse(xs) reverse(all(xs))
#define contain(xs,n) (find(all(xs),n)!=xs.end())
#define unique(xs) xs.erase(unique(all(xs)),xs.end())
#define search(xs,n) distance(xs.begin(),find(all(xs),n))
#define count(xs,n) count(all(xs),n)
#define vecmin(xs) *min_element(all(xs))
#define vecmax(xs) *max_element(all(xs))

template<class C>void mini(C &a,C b){a=min(a,b);}
template<class C>void maxi(C &a,C b){a=max(a,b);}

// 複数，シフト，演算
// #define newvec(T,n,xs) vector<T> xs(n)

#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__)
#define invec(T,n,...) vector<T> __VA_ARGS__;T t;_cinvec(t,n,__VA_ARGS__)
#define invec2(T,n,xs,ys) vector<T> xs(n),ys(n);fou(i,0,n)cin>>xs.at(i)>>ys.at(i)
#define invec3(T,n,xs,ys,zs) vector<T> xs(n),ys(n),zs(n);fou(i,0,n)cin>>xs.at(i)>>ys.at(i)>>zs[i]
// #define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
// #define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define out(...) _cout(__VA_ARGS__)
#define outvec(xs) tra(x,xs) cout << x << " ";cout << endl
void _cin(){}template<class Head,class...Tail>void _cin(Head&&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
void _cout(){}template<class Head,class...Tail>void _cout(Head&&head,Tail&&...tail){cout<<head<<endl;_cout(forward<Tail>(tail)...);}
template<class Type>void _cinvec(Type t,int n){}template<class Type,class Head,class...Tail>void _cinvec(Type t,int n,Head&&head,Tail&&...tail){rep(n){cin>>t;head.eb(t);}_cinvec(t,n,forward<Tail>(tail)...);}


// #define int int64_t
// #define double long double

// map,文字列処理


signed main(){
  in(int,a,b,c,d,e);
  int x=min({a%10,b%10,c%10,d%10,e%10});
  a/=10;a++;a*=10;
  b/=10;b++;b*=10;
  c/=10;c++;c*=10;
  d/=10;d++;d*=10;
  e/=10;e++;e*=10;
  out(a+b+c+d+e+x-10);
}