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