#include <bits/stdc++.h>

using namespace std;

int main()
{
  int res = 0;
  int over = 0;
  int a, b;
  for (int i = 0; i < 5; i++)
  {
    cin >> a;
    res += a;
    b = ceil(a / 10.0) * 10 - a;
    res += b;
    if (b > over)
    {
      over = b;
    }
  }

  cout << res - over << endl;
}