#include <bits/stdc++.h>
using namespace std;

int main() {
  int time[5];
  for (auto &v : time) cin >> v;
  int ans = 0, tmp = 0;
  for (auto &v : time) {
    ans += (v-1)/10 + 1;
    v %= 10;
    if (v) tmp = max(tmp, 10-v);
  }
  cout << ans*10 - tmp << endl;
}
