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

int main()
{
 int N = 5;
 int A, B, C, D, E;
 cin >> A >> B >> C >> D >> E;
 vector<int> currentTime = {A, B, C, D, E};
 vector<int> nextTime(N);
 for(int i = 0; i < N; i++)
 {
     if(currentTime[i] % 10 == 0)
     {
         nextTime[i] = Time[i];
     }
     else
     {
        nextTime[i] = currentTime[i] - currentTime[i] % 10 + 10;
     }
 }
     int BestTime = 999999;
     for(int i = 0; i < N; i++)
     {
         int sumTime = 0;
     for(int j = 0; j < N; j++){
         if(i == j)
         {
             sumTime += currentTime[i];
         }
         else
         {
             sumTime += nextTime[j];
         }
     }
     BestTime = min(BestTime, sumTime);
}
 cout << BestTime << endl;
}