#include <bits/stdc++.h>
using namespace std;
long long int getLastDigit(long long int x) {
  long long int r = 0;
  if (x / 10 == 0)
    r = x;
  else
    r = x % 10 ? x % 10 : 2147483647;
  return r;
}
int main() {
  ios::ios_base::sync_with_stdio(0);
  long long int n = 5;
  long long int x = 0, m = 0, s = 0, max = 0, min = 2147483647;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    min = getLastDigit(x) <= getLastDigit(min) ? x : min;
    m = x % 10 ? x + (10 - x % 10) : x;
    s += m;
  }
  long long int substract = min % 10 ? 10 - min % 10 : 0;
  s -= substract;
  cout << s;
  return 0;
}
