#include <bits/stdc++.h>
using namespace std;
int check(int max, int n) {
  if (n % 10 == 0) return 0;
  if (max % 10 >= n % 10) {
    return n;
  } else {
    return max;
  }
}
int calc(int max, int arr[5]) {
  int ans;
  for (int i = 0; i < 5; i++) {
    if (arr[i] == max) {
      ans += arr[i];
    } else if (arr[i] % 10 == 0) {
      ans += arr[i];
    } else {
      ans += (arr[i] + (10 - arr[i] % 10));
    }
  }
  return ans;
}
int main() {
  int ant[5] = {0};
  int max = 9;
  for (int i = 0; i <= 5; i++) {
    cin >> ant[i];
    int hoge = check(max, ant[i]);
    if (hoge == 0) {
    } else {
      max = hoge;
    }
  }
  cout << calc(max, ant) << endl;
}
