#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int count = 0;
  vector<int> v(6);
  for (int i = 0; i < 5; ++i) {
    cin >> v[i];
  }
  int min = *min_element(v.begin(), v.end());
  for (int i = 0; i < 5; ++i) {
    if (min == v[i]) {
      v[i] = 0;
      count += 1;
    }
    if (v[i] % 10 == 0)
      v[i] = v[i] / 10;
    else
      v[i] = v[i] / 10 + 1;
  }
  for (int i = 0; i < 5; ++i) {
    ans += v[i] * 10;
  }
  ans += min * count;
  cout << ans << endl;
}
