#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int max = 10;
  if (a % 10 < max) {
    if (a % 10 != 0) max = a;
  }
  if (b % 10 < max) {
    if (b % 10 != 0) max = b;
  }
  if (c % 10 < max) {
    if (c % 10 != 0) max = c;
  }
  if (d % 10 < max) {
    if (d % 10 != 0) max = d;
  }
  if (e % 10 < max) {
    if (e % 10 != 0) max = e;
  }
  if (a % 10 != 0) a = ((a / 10) + 1) * 10;
  if (b % 10 != 0) b = ((b / 10) + 1) * 10;
  if (c % 10 != 0) c = ((c / 10) + 1) * 10;
  if (d % 10 != 0) d = ((d / 10) + 1) * 10;
  if (e % 10 != 0) e = ((e / 10) + 1) * 10;
  int z = 0;
  if (max % 10 != 0) z = ((max / 10) + 1) * 10;
  if (max == 10) max = 0;
  cout << a + b + c + d + e - z + max << endl;
}
