#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c,d;
cin >> a >> b >> c >> d;
if (b + d >= 60){
cout << c - a + ((b + d) / 60) << " " << (b + d) % 60 <<endl;
}else {
cout << c - a << " " << b + d <<endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
double f;
if (n = 1) {
f = n * 5.0;
}else if (5 >= n >= 2){
f = n * 4.5;
}else if (10 >= n >= 6){
f = n * 4.0;
}else {
f = n * 3.5;
}cout << fixed << setprecision(1) << f << endl;
return 0;
}