#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int v[5];
  for (int i=0;i<5;i++){
    cin >> v[i];
  }
  int w[5],count=0,sum=0;
  for (int i=0;i<5;i++){
    w[i]=((v[i]+9)/10)*10;
    count=max(count,w[i]-v[i]);
    sum+=w[i];
  }
  cout << sum-count << endl;
}