#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int a[7];
  int x = 0;
  int o = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10) {
      x = max(10 - a[i] % 10, x);
      o = a[i];
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] != o) {
      ans += a[i];
      if (a[i] % 10) {
        ans += 10;
        ans -= a[i] % 10;
      }
    }
  }
  ans += o;
  cout << ans;
  return 0;
}
