#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a = 0, m = 11, k = 5;
  while (k-- && cin >> t) {
    a += (t + 9) / 10 * 10;
    if (t % 10 != 0) m = min(m, t % 10);
  }
  cout << a - 10 + m << endl;
}
