#include <bits/stdc++.h>
using namespace std;

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;

const int MOD = 1000000007;
ll mult(ll a, ll b){
	return (a*b)%MOD;
}
ll bpow(ll x, ll k){
	ll ans = 1;
	while (k > 0){
		if (k%2 == 1){
			ans = mult(ans, x);
			k--;
		}
		k/=2;
		x = mult(x, x);
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	map<pair<ll,ll>, int> occ;
	int a0 = 0;
	for (int i = 0; i < n; i++){
		ll A,B;
		cin>>A>>B;
		if (A == 0 && B == 0){
			a0++;
			continue;
		}
		if (A == 0){
			occ[{0, 1}]++;
		}else if (B == 0){
			occ[{-1, 0}]++;
		}else{
			ll div = __gcd(abs(A), abs(B));
			A/=div; B/=div;
			if (B == -1){
				A *= -1;
				B *= -1;
			}
			occ[{A, B}]++;
		}
	}
	vector<int> vals;
	for (auto it: occ){
		auto fish = it.first;
		pair<ll,ll> target = {-fish.second, fish.first};
		if (target.second < 0){
			target.first *= -1;
			target.second *= -1;
		}
		cout<<fish.first<<' '<<fish.second<<"  "<<target.first<<' '<<target.second<<'\n';
		vals.push_back((bpow(2, occ[target]) + bpow(2, it.second) - 1) % MOD);
		occ.erase(target);
	}
	int ans = 1;
	for (auto it: vals){
		cout<<it<<'\n';
		ans = mult(ans, it);
	}
	cout<<(ans + a0-1)%MOD<<'\n';
	return 0;
}