#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30) - 1;

int main()
{
  int sum = 0, remain = 0;
  for (int i = 0; i < 5; i++){
    int a; cin >> a;
    int time = (a + 9) / 10 * 10;
    sum += time;
    remain = max(remain, time - a);
  }
  cout << sum - remain << endl;
  return 0;
}