#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> arr(5);
  for (int i = 0; i < 5; i++) cin >> arr[i];
  sort(arr.begin(), arr.end(),
       [](int a, int b) { return ((a - 1) % 10) < ((b - 1) % 10); });
  int sum = 0;
  for (int i = 4; i > 0; i--) {
    sum += arr[i] + 9;
    sum -= sum % 10;
  }
  sum += arr[0];
  cout << sum;
  return 0;
}
