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

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	cin>>n;
	
	map<pair<long long, long long>, pair<int, int>> m;
	int zeros = 0;
	
	for (int i=0; i<n; i++){
		int a, b;
		cin>>a>>b;
		if (a==0 && b==0) zeros++;
		else{
				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> p = e.first;
		pair<int, int> cnt = e.second;
		// cout<<p.first<<" "<<p.second<<" "<<cnt.first<<" "<<cnt.second<<endl;
		ans *= pow(2, cnt.first)+ pow(2, cnt.second)-1;
		ans = ans%mod;
		
	}
	if (zeros) ans *= zeros;
	ans = ans%mod;
	ans--;
	cout<<ans<<endl;
	return 0;
}