#include <bits/stdc++.h>
using namespace std;
struct Fast {
  Fast() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
  }
} fast;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
int main(void) {
  long long result = 0;
  vector<long long> menu;
  for (int i = 0; i < (int)(5); i++) {
    long long x = in();
    menu.push_back(x);
  }
  vector<long long> rest;
  long long sum;
  for (int i = 0; i < (int)(5); i++) {
    long long x = 10 - menu[i] % 10;
    if (x < 10) {
      rest.push_back(x);
      sum += x;
    }
  }
  sum -= *max_element(rest.begin(), rest.end());
  for (int i = 0; i < (int)(5); i++) {
    sum += menu[i];
  }
  cout << sum;
  return 0;
}
