#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;
int main() {
  vector<int> a(5);
  int idx;
  int mini = 9;
  for (int i = 0; i < (5); ++i) {
    int x;
    cin >> x;
    int tmp = x % 10;
    if (tmp != 0 && tmp < mini) {
      idx = i;
      mini = tmp;
    }
    a[i] = x;
  }
  int ans = 0;
  for (int i = 0; i < (5); ++i) {
    if (i != idx) {
      if (a[i] % 10 != 0) {
        int x = (10 - a[i] % 10) + a[i];
        ans += x;
      } else {
        ans += a[i];
      }
    } else {
      ans += a[i];
    }
  }
  cout << ans;
  return 0;
}
