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