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