#include <iostream>
using namespace std;

int main()
{
  int dish[5];
  for(int i = 0; i < 5; i++)
  {
    cin >> dish[i];
  }
  for(int j = 0; j < 4; j++)
  {
    for(int k = j + 1; k < 5; k++)
    {
      if(dish[j] % 10 < dish[k] % 10 || dish[k] % 10 == 0)
      {
        int tmp = dish[j];
        dish[j] = dish[k];
        dish[k] = tmp;
      }
    }
  }
  int sum = 0;
  for(int a = 0; a < 4; a++)
  {
    if(dish[a] % 10)
    {
      sum += dish[a];
    }
    else
    {
      sum += dish[a] - dish[a] % 10 + 10;
    }
  }
  sum += dish[4]
  cout << sum << '\n';
  return 0;
}