#include <bits/stdc++.h>
using namespace std;
int digit(int n) { return n % 10; }
int main() {
  int n = 5;
  int a[5];
  for (int i = 0; i < n; i++) cin >> a[i];
  int c[5] = {a[0] % 10, a[1] % 10, a[2] % 10, a[3] % 10, a[4] % 10};
  int sum = 0;
  for (int i = 0; i < n; i++) sum += c[i];
  if (sum == 0) {
    int ans2 = 0;
    for (int i = 0; i < n; i++) {
      ans2 += a[i];
    }
    cout << ans2 << endl;
    return 0;
  } else {
    int min = 10;
    int index = 6;
    for (int j = 0; j < n; j++) {
      if (min > c[j]) {
        if (c[j] == 0) continue;
        c[j] = min;
        index = j;
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % 10 == 0 || i == index)
        ans += a[i];
      else
        ans += a[i] + (10 - a[i] % 10);
    }
    cout << ans << endl;
  }
}
