#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
int a[5], k;
int main() {
  int ind = 0, m = 10;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      if (m > a[i] % 10) ind = i, m = a[i] % 10;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == ind)
      ans += a[i];
    else {
      if (a[i] % 10 == 0)
        ans += a[i];
      else
        ans += a[i] + 10 - a[i] % 10;
    }
  }
  cout << ans << endl;
}
