#include <bits/stdc++.h>
using namespace std;
int maxtime(int x) { return (x + 9) / 10 * 10; }
int remitime(int x) { return (x)-x; }
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int sum =
      maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e) -
      max({remitime(a), remitime(b), remitime(c), remitime(d), remitime(e)});
  cout << sum << endl;
}
