#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a / GCD(a, b) * b; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cmp(pair<long long int, long long int> a,
        pair<long long int, long long int> b) {
  if (a.first != b.first)
    return a.first > b.first;
  else
    return a.second < b.second;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a[5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  int min = 10e12;
  for (int i = 0; i < 5; i++) {
    if (a[i] < 10)
      min = std::min(min, a[i]);
    else if (a[i] < 100 && a[i] % 10 != 0)
      min = std::min(min, a[i] % 10);
    else if (a[i] >= 100 && a[i] % 10 % 10 != 0)
      min = std::min(min, a[i] % 10 % 10);
  }
  if (min == 10e12) min = 10;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    while (a[i] % 10 % 10 != 0) a[i]++;
    sum += a[i];
  }
  sum -= (10 - min);
  cout << sum << endl;
  return 0;
}
