#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int ans=0,a[5],b[5],B=0;
  for(int i=0;i<5;i++){
    cin>>a[i];
    b[i]=10-a[i]%10;
    if(b[i]==10) b[i]=0;
    ans+=a[i]+b[i];
    B=max(b[i],B);
  }
  cout<<ans-B<<endl;
}
