#include<bits/stdc++.h>
using namespace std;
#define int long long 
//using int128 = __int128;
typedef long long ll;
typedef pair<int,int>pi;
typedef vector<int>vi;
const int MAXN=200005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int N, A[MAXN], B[MAXN];
map<pi, int> M;
pi reduce(pi x){
	bool sign = (x.first>=0)^(x.second>=0);
	x.first = abs(x.first);
	x.second = abs(x.second);
	int d = __gcd(x.first, x.second);
	int num = x.first/d;
	int denom = x.second/d;
	if (!sign) return {num,denom};
	else return {-num,denom};
}

pi inverse(pi x){
	bool sign = (x.first>=0)^(x.second>=0);
	x.first = abs(x.first);
	x.second = abs(x.second);
	if (!sign) return {-x.second, x.first};
	else return {x.second, x.first};
}

ll qmult(ll X, ll Y, ll M) {    
    return X * Y % M;
}

ll qexp(ll A, ll B, ll M) {
    if (B == 0) return 1;
    ll half = qexp(A, B/2, M); 
    half = qmult(half, half, M); 
    half %= M;
    if (B%2==1) half *= A%M;
    return half%M;
}

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	FOR(i,1,N) cin>>A[i]>>B[i];
	FOR(i,1,N) {
		pi p = reduce({A[i],B[i]});
		M[p]++;
	}
	int ans = 1;
	for (auto x:M){
		if (x.second == 0) continue;
		if (x.first == mp(0LL,0LL)){
			ans *= qexp(2,x.second,MOD);
			ans %= MOD;
			continue;
		}
		pi inv = inverse(x.first);
		int tmp = (qexp(2,x.second,MOD) + qexp(2, M[inv], MOD) -1)%MOD;
		ans *= tmp;
		ans %= MOD;
		M[inv] = 0;
	}
	cout<<ans-1;
}
