#include <bits/stdc++.h>
using namespace std;
long long dx[4] = {1, 0, -1, 0};
long long dy[4] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a, b, c, d, m, n, maxi = 0, f = 0, mini = LLONG_MAX, sum = 0;
  string str;
  vector<long long> v(5);
  for (long long i = (long long)(0); i < (long long)(5); i++) cin >> v[i];
  for (long long i = (long long)(1); i < (long long)(10); i++) {
    for (long long j = (long long)(0); j < (long long)(5); j++) {
      if (v[j] % 10 == i) {
        sum += v[j];
        v.erase(v.begin() + j);
        f = 1;
        break;
      }
    }
    if (f == 1) break;
  }
  for (long long i = (long long)(0); i < (long long)(4); i++) {
    if (v[i] % 10 != 0) sum += 10;
    sum += v[i] / 10 * 10;
  }
  cout << sum << endl;
  return 0;
}
