#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  vector<int> v(5);
  vector<int> c(5);
  int k;
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    if (v[i] % 10 == 0)
      c[i] = 10;
    else
      c[i] = v[i] % 10;
  }
  sort(v.begin(), v.end());
  sort(c.begin(), c.end());
  int count = 0;
  for (int i = 0; i < 4; i++) {
    if (v[i] % 10 != 0) {
      count = count + (v[i] / 10 + 1) * 10;
    } else
      count = count + v[i];
  }
  count = count + v[4];
  cout << count - 10 + c[0] << endl;
}
