#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
  int a[5];
  int time=0;
  int amari=9;
  rep(i,5){
    cin >> a[i];
    time += (a[i] + 9) / 10;
    if (a[i] % 10 < amari) amari = a[i] % 10;
  }
  time = (time-1) * 10 + amari;
  cout << time;
}
      