#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[5];
  int min = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (int i = 0; i < 4; ++i) {
    min = a[i];
    if ((min + a[i + 1]) / 10 == 0)
      min += a[i + 1];
    else if ((min + a[i + 1]) % 10 != 0)
      min = (((min + a[i + 1]) / 10) + 1) * 10;
    else
      min += a[i + 1];
  }
  return 0;
}
