#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int A = 0;
  for (int i = 0; i < 5; i++) {
    if (A < 10 - a[i] % 10) A = i;
  }
  int time = 0;
  for (int i = 0; i < 5; i++) {
    if (i != A) time += a[i] / 10 * 10 + 10;
  }
  time += a[A];
  cout << time << endl;
  return 0;
}
