#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T GCD(T a, T b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
  return (a * b) / GCD(a, b);
}
ll modpow(ll a, ll n) {
  a %= 1000000007;
  if (n == 0) return 1;
  if (n == 1) return a % 1000000007;
  if (n % 2)
    return a * modpow(a, n - 1) % 1000000007;
  else
    return (modpow(a, n / 2) * modpow(a, n / 2)) % 1000000007;
}
ll culc(ll a, ll n) {
  ll up = 1;
  ll down = 1;
  for (ll i = n - a + 1; i <= n; i++) {
    up *= i % 1000000007;
    up %= 1000000007;
  }
  for (ll i = 1; i <= a; i++) {
    down *= i % 1000000007;
    down %= 1000000007;
  }
  down = modpow(down, 1000000007 - 2);
  return up * down % 1000000007;
}
void ch(int &n) {
  n += 10 - n % 10;
  n /= 10;
}
int main() {
  vector<int> a(5);
  vector<int> v;
  int mini = 10;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    v[i] = a[i];
    ch(a[i]);
    v[i] %= 10;
    cout << v[i] << endl;
    if (v[i] != 0) {
      mini = min(mini, v[i]);
    }
  }
  if (mini == 10) {
    mini = 0;
  }
  sort(a.begin(), a.end());
  int sum = 0;
  for (int i = 0; i < 4; i++) {
    sum += a[i + 1];
  }
  cout << sum * 10 + mini << endl;
}
