#include <bits/stdc++.h>
#pragma gcc optimize("Ofast")
using namespace std;
using ll = long long;
const long long MOD = 1000000007;
const long long INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
string toStrUp(string str) {
  char diff = 'A' - 'a';
  for (long long i = (0); i < (str.size()); ++i) str[i] += diff;
  return str;
}
string gCh(string str, long long key) { return str.substr(key, 1); }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n = 0, m = 0, a = 0, b = 0, c = 0, d = 0, x = 0, y = 0, z = INF;
  string s = "", t = "";
  vector<ll> v(5);
  for (long long i = 0; i < (v).size(); i++) {
    cin >> (v).at(i);
  }
  for (long long i = (0); i < (5); ++i) {
    if (v[i] % 10 != 0) {
      if (min(z, v[i] % 10) == v[i] % 10) c = v[i];
    }
  }
  for (long long i = (0); i < (5); ++i) {
    if (v[i] != c) {
      while (v[i] % 10 != 0) v[i]++;
      m += v[i];
    }
  }
  cout << m + c << '\n';
}
