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