#include<iostream>
using namespace std;
int main(){
  int a,i,ans,l,k;ans = 0;l = 10;
  for (i=0;i<5;i++){
    cin >> a;
    ans += (a/10)*10;
    k = a%10;
    if(k != 0) ans += 10; 
    else k = 10;
    if (k < l) l = k;
  }
  cout << ans-(10-l) << endl;
}