#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) cin >> a[i];
  int min_a = 1 << 30, min_i = 0;
  for (int i = 0; i < 5; ++i) {
    if (a[i] % 10 != 0 and min_a > a[i] % 10) {
      min_a = a[i] % 10;
      min_i = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    ans += a[i];
    if (ans % 10 != 0) {
      ans += (10 - ans % 10);
    }
  }
  cout << ans - 10 + min_a << endl;
}
