#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  int t = 0, min = 10;
  for (int i = 0; i < 5; i++) cin >> a[i];
  for (int i = 0; i < 5; i++) {
    if ((min > (a[i] % 10)) && ((a[i] % 10) != 0)) min = i;
  }
  if (min != 4) swap(a[min], a[4]);
  for (int i = 0; i < 4; i++) t += ((a[i] + 9) / 10) * 10;
  t += a[4];
  cout << t << endl;
}
