#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int *place;
  int total = 0;
  int rem = 10;
    time = new int[5];
    for(int i=0;i<5;i++)
    {
        scanf("%d",&time[i]);
    }
  for(int i=0;i<5;i++)
  {
    int r = time[i] % 10;
    if( r < rem)
    {
      rem = r;
    }
      total += (time[i]/10 +(r!=0));
  }
  total = total * 10;
    cout << total << endl;
  }
}
