#include <bits/stdc++.h>
using namespace std;
int const N = 2 * 1e5 + 2;
int a[6], aa[6];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < (int)(5); ++i) cin >> a[i];
  int mx = -1, value;
  for (int i = 0; i < (int)(5); ++i) {
    for (int j = 0; j <= 130; j += 10) {
      if (a[i] <= j) {
        if (mx <= j - a[i]) {
          mx = j - a[i];
          value = a[i];
        }
        aa[i] = a[i] + (j - a[i]);
        break;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < (int)(5); ++i) {
    if (a[i] != value) {
      sum += aa[i];
    }
  }
  cout << sum + value << endl;
}
