#include <bits/stdc++.h>
using ll = unsigned long long;
using namespace std;
int main(void) {
  int* a = new int[5];
  for (int j = 0; j < 5; ++j) {
    cin >> a[j];
  }
  int min_ix = 0;
  int min_val = a[0] % 10;
  int min_check = 10;
  for (int s = 1; s < 5; ++s) {
    min_check = a[s] % 10;
    if (min_check < min_val) {
      min_ix = s;
    } else {
      a[s] += 10 - min_check;
    }
  }
  int total = 0;
  for (int u = 0; u < 5; ++u) {
    total += a[u];
  }
  cout << total << endl;
  return 0;
}
