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