// ACPC_AIZUDAI_DROPOUT
// coder : naan

#include <bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    long cons{0}, coef{1};
    for(unsigned long i = 0, q, x; i < N; ++i){
        cin >> q >> x;
        if(q == 1){
            cons *= x;
            coef *= x;
        }else if(q == 2){
            cons += x;
        }else{
            cons -= x;
        }
    }
    cout << -cons << " " << coef << endl;
    return 0;
}
