#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
long modpow(long x,int n){
	int i = 0;long res = 1;
	while(n >= (1<<i)){
		if(n & (1<<i)) (res *= x) %= mod;
		i++;
		x = (x * x) % mod;
	}return res;
}
int main(){
	int N; cin>>N;
    long A, B;
	map<pair<long,long>,pair<int,int>> mp;
	rep(i,0,N){
		cin>>A>>B;
		long g = gcd(A, B);
		A /= g; B /= g;
        if(A < 0){ A = -A; B = -B; }
        if(A == 0 && B < 0) B = -B;
		if(B > 0) mp[{A,B}].first++;
		else mp[{-B,A}].second++;
	}long ans = 1;
	for(pair<pair<long,long>,pair<int,int>> p:mp){
		int s = p.second.first;
		int t = p.second.second;
		(ans *= (modpow(2, s) + modpow(2, t) - 1) % mod) %= mod;
	}cout<<(ans + mod - 1) % mod<<endl;
}