#include <bits/stdc++.h>
using namespace std;
int main() {
  queue<int> que;
  int mI = INT_MAX;
  int mN = INT_MAX;
  for (auto i = (0); (i) < (5); ++(i)) {
    int inp;
    cin >> inp;
    if (mI > inp % 10 and inp % 10 != 0) {
      que.push(mN), mI = inp % 10, mN = inp;
    } else
      que.push(inp);
  }
  int ans = 0;
  que.pop();
  for (auto i = (0); (i) < (4); ++(i)) {
    int tmp = que.front();
    que.pop();
    if (tmp % 10)
      ans += tmp + (10 - tmp % 10);
    else
      ans += tmp;
    cerr << ans << endl;
  }
  cout << ans + mN << endl;
}
