#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 1;
const long long MOD = 1e9 + 7;
const double PI = 3.141592653589793;
int main() {
  int a[5];
  int b[5];
  for (int i = 0; i < (int)(5); i++) cin >> a[i];
  for (int i = 0; i < (int)(5); i++) b[i] = a[i] % 10 == 0 ? 20 : a[i] % 10;
  sort(b, b + 5);
  int k;
  k = b[0] == 20 ? 0 : b[0];
  int ans = 0;
  for (int i = 0; i < (int)(5); i++) {
    a[i] = a[i] - a[i] % 10 + (a[i] % 10 == 0 ? 0 : 10);
    ans += a[i];
  }
  cout << ans - (10 - k) << endl;
}
