#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int smax = -1;
  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    int s = (10 - (a % 10)) % 10;
    ans += (a + s);
    if (s != 0) smax = max(smax, s);
  }
  cout << (ans - smax) << endl;
}
