#include <iostream>
using namespace std;
int main() {
const char* repair{ "The engine needs maintenance" };
const char* message{ " hours passed.\n" };
constexpr auto limit = 5000U;
unsigned y, d, h, total;
cin >> y >> d >> h;
total = y * 8760 + d * 24 + h;
cout << total << message;
if (limit < total) puts(repair);
}