#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  vector<int> vec(5);
  int a = 9;
  int idx;
  for (int i = 0; i < 5; ++i) {
    cin >> vec[i];
    int tmp = vec[i] % 10;
    if (tmp == 0) tmp = 10;
    if (tmp <= a) {
      idx = i;
      a = tmp;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    if (i == idx) continue;
    ans += (vec[i] + 10 - 1) / 10 * 10;
  }
  ans += vec[idx];
  cout << ans << endl;
  return 0;
}
