#include <bits/stdc++.h>
using namespace std;
struct aaa {
  aaa() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {1, 1, 0, -1, -1, -1, 0, 1},
          dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
signed main() {
  vector<int> a(5);
  for (int i = 0, i_len = 5; i < i_len; ++i) cin >> a[i];
  vector<int> b(5);
  int las = 0;
  int go{};
  int cnt{};
  int ans{};
  for (int i = 0; i < 5; ++i) {
    b[i] = a[i] % 10;
  }
  for (int i = 0; i < 5; ++i) {
    if (b[i] == 0) b[i] == 100;
    if (b[i] == *min_element(b.begin(), b.end())) {
      las = i;
    }
  }
  go = a[las];
  int tmp = a[4];
  a[4] = a[las];
  a[las] = tmp;
  for (int i = 0; i < 4; ++i) {
    while (a[i] % 10 != 0) {
      ++a[i];
    }
  }
  cout << a[0] + a[1] + a[2] + a[3] + go;
  return 0;
}
