#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> h(5),a(5),b(5);
  int c=0;
  for (int i=0;i<5;i++){
    cin >> h[i];
    a[i]=(h[i]+9)/10*10;
    b[i]=a[i]-h[i];
  }
  cout << a[0]+a[1]+a[2]+a[3]+a[4]-max({b[0],b[1],b[2],b[3],b[4]})<< endl;
}