#include <bits/stdc++.h>
using namespace std;
void FAST();
long long int big_mod(long long int val, long long int pow, long long int mod);
long long int mod_inverse(long long int val, long long int mod);
int main() {
  FAST();
  int i, ans = 0, mark = -1, check = 9, a[7];
  for (i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] % 10 > 0 && a[i] % 10 < check) {
      check = a[i] % 10;
      mark = a[i];
    }
  }
  bool flag = 0;
  for (i = 1; i <= 5; i++) {
    if (a[i] == mark && flag == 0) {
      ans += mark;
      flag = 1;
    } else if (a[i] % 10 == 0) {
      ans += a[i];
    } else {
      ans += (((a[i] / 10) + 1) * 10);
    }
  }
  cout << ans;
  return 0;
}
void FAST() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long int big_mod(long long int val, long long int pow, long long int mod) {
  long long int res = 1;
  val = val % mod;
  while (pow > 0) {
    if (pow & 1) {
      res = (res * val) % mod;
    }
    pow = pow >> 1;
    val = (val * val) % mod;
  }
  return res;
}
long long int mod_inverse(long long int val, long long int mod) {
  long long int mod1 = mod;
  if (mod == 1) {
    return 0;
  }
  long long int y = 0;
  long long int x = 1;
  long long int quotient, temp;
  while (val > 1) {
    quotient = val / mod;
    temp = mod;
    mod = val % mod;
    val = temp;
    temp = y;
    y = x - quotient * y;
    x = temp;
  }
  if (x < 0) {
    x += mod1;
  }
  return x;
}
