#include <iostream>
#include <valarray>
using namespace std;

int main()
{
  valarray<int> a(5), b(5);
  for (auto&& e : a) cin >> e;
  b = (a + 9) / 10 * 10;
  cout << b.sum() - (b - a).max() << endl;
}
