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