#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

const int N = 200200;
long long p2[N];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	p2[0] = 1; 
	for (int i=1; i<N; i++){
		p2[i] = (p2[i-1]*2)%mod;
	}
	
	int n;
	cin>>n;
	
	map<pair<long long, long long>, pair<int, int>> m;
	int zeros = 0;
	
	for (int i=0; i<n; i++){
		long long int a, b;
		cin>>a>>b;
		if (a==0 && b==0) zeros++;
		else{
				long long int g = __gcd(abs(a), abs(b));
				a /= g;
				b /= g;
				if (a>0 and b>=0){
					m[{a, b}].first++;
				}
				else if (a<0 and b<=0){
					m[{-a,-b}].first++;
				}
				else if(a>0 and b<=0){
					m[{-b, a}].second++;
				}
				else if (a<0 and b>=0){
					m[{b, -a}].second++;
				}
		}
	}

	long long int ans = 1;
	for (auto e: m){
		pair<int, int> cnt = e.second;
		ans *= 1LL*p2[cnt.first] + 1LL*p2[cnt.second]-1LL;
		ans = ans%mod;
		
	}
	if (zeros) ans *= 1LL*zeros;
	ans = ans%mod;
	ans--;
	cout<<ans<<endl;
	return 0;
}