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