#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
int oo(int x) { return (x / 10 + 1) * 10; }
int re(int x) { return oo(x) - x; }
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int sum = oo(A) + oo(B) + oo(C) + oo(D) + oo(E);
  sum -= max({re(A), re(B), re(C), re(E), re(D)});
  cout << sum << endl;
}
