#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  vector<int> v1, v2;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0)
      v1.push_back(a[i]);
    else
      v2.push_back(a[i]);
  }
  int sum = 0;
  int l1 = v1.size(), l2 = v2.size(), idx, mn = -1, d;
  for (int i = 0; i < l2; i++) {
    d = v2[i] % 10;
    d = 10 - d;
    if (d > mn) {
      mn = d;
      idx = i;
    }
  }
  for (int i = 0; i < l1; i++) sum += v1[i];
  for (int i = 0; i < l2; i++) {
    if (i == idx) continue;
    sum += v2[i];
    sum += 10 - (v2[i] % 10);
  }
  sum += v2[idx];
  cout << sum << "\n";
  return 0;
}
