#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
int main(void) {
  vl r(5);
  for (int i = 0; i < 5; i++) cin >> r[i];
  vl a(5);
  for (int i = 0; i < 5; i++) {
    a[i] = r[i] % 10;
    if (a[i] == 0) a[i] == 10;
  }
  sort(r.begin(), r.end());
  lint ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == 4) {
      cout << ans + r[4];
      return 0;
    }
    ans += r[i];
    if (a[i] != 0) ans += 10 - a[i];
  }
}
