#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> time(5);
  for (int i = 0; i < (int)(5); i++) {
    int T;
    cin >> T;
    time[i] = T;
  }
  sort(time.rbegin(), time.rend());
  int ans = 0;
  for (int i = 0; i < (int)(4); i++) {
    int res = 0;
    res = (time[i] + 9) / 10 * 10;
    ans += res;
  }
  ans += time[4];
  cout << ans << endl;
}
