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