#include <bits/stdc++.h>
using namespace std;
const int inf = 1012345678;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
int a[6];
int M = 10;
int mod;
int main() {
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0)
      break;
    else {
      mod = a[i] % 10;
      a[i] = a[i] + 10 - mod;
      M = min(mod, M);
    }
  }
  int time = 0;
  if (M == 10) {
    for (int i = 0; i < 5; i++) {
      time += a[i];
    }
  } else {
    for (int i = 0; i < 5; i++) {
      time += a[i];
    }
    time = time + M - 10;
  }
  cout << time << endl;
  return 0;
}
