#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int a[5], k;
  long long int idx = -1;
  long long int b = INT_MAX;
  for (long long int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) {
      long long int x = a[i] % 10;
      if (x < b) {
        b = x;
        idx = i;
      }
    }
  }
  long long int c = 0;
  for (long long int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      c += a[i];
      a[i] = -1;
    }
  }
  for (long long int i = 0; i < 5; i++) {
    if (a[i] != -1 && i != idx) {
      c = c + a[i] + 10 - (a[i] % 10);
    }
  }
  cout << c + a[idx] << "\n";
  return 0;
}
