#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}
ll rep_jijo(ll n, ll x) {
  if (x == 0) return 1;
  if (x % 2 == 0) {
    ll t = rep_jijo(n, x / 2);
    return t * t % 1000000007;
  }
  return n * rep_jijo(n, x - 1) % 1000000007;
}
ll com(ll n, ll r) {
  ll x = 1, y = 1;
  ll tmp = n;
  while (tmp >= n - r + 1) {
    x = x * tmp % 1000000007;
    tmp--;
  }
  while (r > 0) {
    y = y * r % 1000000007;
    r--;
  }
  return x * rep_jijo(y, 1000000007 - 2) % 1000000007;
}
int main() {
  int a[5];
  int b[5];
  int r = 1001001001;
  int ans = 0;
  int num;
  for (int i = 0; i < (int)(5); i++) {
    int x;
    cin >> x;
    a[i] = x;
    int y = x % 10;
    b[i] = y;
    if (y == 0) continue;
    if (y <= r) {
      r = y;
      num = i;
    }
  }
  if (r == 1001001001) {
    for (int i = 0; i < (int)(5); i++) ans += a[i];
    cout << ans << endl;
    return 0;
  }
  for (int i = 0; i < (int)(5); i++) {
    if (i == num)
      ans += a[i];
    else {
      ans += a[i] + 10 - b[i];
    }
  }
  cout << ans << endl;
  return 0;
}
