#include <bits/stdc++.h>

using namespace std;

#define ll long long

signed main() {
	ll a, b;
	a = 1; b = 0;
	int n; cin >> n;
	while (n--) {
		int q, x;
		cin >> q >> x;
		if (q == 1) {
			a *= x; b *= x;
		}
		else if (q == 2)
			b += x;
		else
			b -= x;
	}

	cout << (-b) << " " << a << endl;

	return 0;
}
