#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], c = 0, d, sum = 0;
  string s;
  vector<pair<int, int>> b(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    int d;
    d = a[i] % 10;
    if (d != 0) {
      b[i] = make_pair(d, i);
      c++;
    }
  }
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  for (int i = 0; i < c - 1; i++) {
    int k = 0;
    k = a[b[i].second];
    k += (k + 9) / 10 - k;
    k *= 10;
    sum += k;
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) sum += a[i];
  }
  sum += a[b[c - 1].second];
  cout << sum;
  return 0;
}
