// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int n;
ll q[15], x[15];
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> n;
  ll a = 1, b = 0;
  for(int i = 0; i < n; i++) {
    cin >> q[i] >> x[i];
    if(q[i] == 1) {
      // (aX + b) x = axX + bx
      a *= x[i];
      b *= x[i];
    } else if(q[i] == 2) {
      // (aX + b) + x
      b += x[i];
    } else {
      // (aX + b) - x
      b -= x[i];
    }
  }
  cout << -b << " " << a << endl;
  return 0;
}

