#include <bits/stdc++.h>
using namespace std;
int main() {
  int MIN = 9;
  int ans = 0;
  for (long long i = 0; i < (long long)(5); i++) {
    int t;
    cin >> t;
    if (t % 10 < MIN && t % 10 != 0) MIN = t % 10;
    ans += (t + 9) / 10 * 10;
  }
  cout << ans - 10 + MIN << endl;
}
