#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
long long Madd(long long x, long long y) {
  return (x + y) % (long long)(1e9 + 7);
}
long long Msub(long long x, long long y) {
  return (x - y + (long long)(1e9 + 7)) % (long long)(1e9 + 7);
}
long long Mmul(long long x, long long y) {
  return (x * y) % (long long)(1e9 + 7);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  vector<long long> a(5);
  for (long long i = (long long)0; i < (long long)5; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  long long ans = INT_MAX;
  do {
    long long s = 0;
    for (long long i = (long long)0; i < (long long)5; i++) {
      s += (a[i] / 10) * 10;
    }
    ans = min(ans, s);
  } while (next_permutation(a.begin(), a.end()));
}
