#include <bits/stdc++.h>
using namespace std;
int z(int x) { return (x - 1) - (x - 1) % 10 + 10; }
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 (max != 10)
    cout << z(a) + z(b) + z(c) + z(d) + z(e) - 10 + max % 10 << endl;
  else
    cout << z(a) + z(b) + z(c) + z(d) + z(e) << endl;
}
