#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int time = 0;
  int tmp = 0;
  int t;
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    tmp = 9;
    if (a[i] % 10 <= tmp && a[i] % 10 != 0) {
      tmp = a[i] % 10;
      t = i;
    }
  }
  for (int i = 0; i < 5; i++) {
    if (i != t) {
      if (i == 4) {
        time += a[i];
      } else {
        time += a[i];
        tmp = (time / 10 + 1) * 10;
        time = tmp;
      }
    } else {
      continue;
    }
  }
  time += a[t];
  cout << time << endl;
  return 0;
}
