#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int ans=0;
  int cur=0;
  rep(i,0,5){
    int t;
    cin>>t;
    ans+=(t+9)/10*10;
    cur=max(cur,9-(t-1)%10);
  }
  cout<<ans-cur<<endl;
}