#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int arr[5];
  int ans = INT_MAX, tmp;
  for (int i = 0; i < 5; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + 5);
  do {
    tmp = 0;
    for (int i = 0; i < 5; i++) {
      tmp += arr[i];
      if (tmp % 10 && i < 4) {
        tmp = ((tmp / 10) + 1) * 10;
      }
    }
    ans = min(ans, tmp);
  } while (next_permutation(arr, arr + 5));
  cout << ans;
  return 0;
}
