#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> A(5);
  for (int i = 0; i < (5); i++) cin >> A[i];
  int num = 0;
  int ans = 0;
  int min = 10;
  for (int i = 0; i < (5); i++) {
    if (min > A[i] % 10) {
      min = A[i] % 10;
      num = i;
    }
  }
  for (int i = 0; i < (num); i++) {
    if (A[i] % 10 == 0)
      ans += A[i];
    else {
      ans += {10 - (A[i] % 10) + A[i]};
    }
  }
  for (int i = num + 1; i < 5; i++) {
    if (A[i] % 10 == 0)
      ans += A[i];
    else {
      ans += {10 - (A[i] % 10) + A[i]};
    }
  }
  ans += A[num];
  cout << ans;
}
