#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  ll ra,rb,rc,rd,re;
  ra = ((a+9)/10)*10-a;
  rb = ((b+9)/10)*10-b;
  rc = ((c+9)/10)*10-c;
  rd = ((d+9)/10)*10-d;
  re = ((e+9)/10)*10-e;
  ll num;
  num = max(ra,(max(rb,max(rc,max(rd,max(re))))));
  cout << ((a+9)/10)*10+((b+9)/10)*10+((c+9)/10)*10+((d+9)/10)*10+((e+9)/10)*10-num;

  
  
 return 0;
}
