#include using namespace std; int main(){ int y,n,d; cin >> y >> n >> d; cout << max(0,n - d) << " "; y++; if(y%100!=0){ if(y%4!=0) cout << min(n,365 - d) << endl; else cout << min(n,366 - d) << endl; }else{ if(y%40!=0) cout << min(n,365 - d) << endl; else cout << min(n,366 - d) << endl; } }