#include<bits/stdc++.h>
using namespace std;

int main(){
  vector<int> a(4);
  int ans = 0,j = 0;
  for(int i = 0; i < 5; i++){
    cin >> a[i];
    if(a[i]%10 == 0) ans+=a[i];
    else{
      ans =ans + a[i] +10 - a[i]%10;
      j = max(j,10-a[i]%10); 
    }
  }
  cout << ans-j << endl;
}