#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;
//group # with Ai/Bi == abs(Bj/Aj)
//let the leftover types as m
//numbers
ll mult(ll a, ll b){
	return (a*b)%MOD;
}
ll bpow(ll x, ll k){
	int ans = 1;
	while (k > 0){
		if (k%2 == 1){
			ans = mult(ans, x);
			k--;
		}
		k/=2;
		x = mult(x, x);
	}
	return ans;
}
ll gcd(ll a, ll b){
	return __gcd(abs(a), abs(b));
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	// for (int i = 0; i < 10; i++){
	// 	cout<<bpow(2, i)<<'\n';
	// }
	cin>>n;
	map<pair<int,int>, int> occ;
	for (int i = 0; i < n; i++){
		int A,B;
		cin>>A>>B;
		if (A==0 && B==0){
			continue;
		}
		if (A==0){
			occ[{0, 1}]++;
		}else if(B==0){
			occ[{1, 0}]++;
		}else{
			if (B < 0){
				A *= -1;
				B *= -1;
			}
			int div = gcd(A,B);
			A /= div;
			B /= div;
			// cout<<A<<" "<<B<<'\n';
			occ[{A,B}]++;
		}
	}
	vector<int> vals;
	// cout<<'\n';
	for (auto it: occ){
		auto fish = it.first;
		pair<int,int> target = {-fish.second, fish.first};
		if (target.second < 0){
			target.first *= -1;
			target.second *= -1;
		}
		// target.first *= -1;
		assert(target != fish);
		// cout<<fish.first<<' '<<fish.second<<"   "<<target.first<<' '<<target.second<<'\n';
		// cout<<it.second<<' '<<occ[target]<<'\n';
		vals.push_back( ( bpow(2,it.second)+bpow(2,occ[target])-1)%MOD );
		occ.erase(target);
	}
	int ans = 1;
	for (auto it: vals){
		// cout<<it<<'\n';
		ans *= it;
	}
	cout<<ans-1<<'\n';
	return 0;
}