#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
constexpr int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const long double PI = acos(-1);
int main() {
  vector<int> a(5);
  int max = 0;
  int kazu = 0;
  for (ll i = 0; i < 5; i++) {
    cin >> a[i];
    int amari;
    if (a[i] % 10 == 0)
      amari = 0;
    else
      amari = 10 - (a[i] % 10);
    if (amari >= max) {
      max = amari;
      kazu = i;
    }
  }
  int ans = 0;
  for (ll i = 0; i < 5; i++) {
    if (i == kazu)
      continue;
    else {
      if (a[i] % 10 == 0)
        ans += a[i];
      else
        ans += ((a[i] / 10) * 10 + 10);
    }
  }
  cout << ans + a[kazu] << endl;
  return 0;
}
