#include<bits/stdc++.h>
using namespace std;

#define DIV 1000000007

long long N;
long long A[200005];
long long B[200005];

long gcd(long a,long b){
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}

	//a, b -> count
	map<pair<long long, long long>, long long> memo;
	long long azero = 0;
	long long bzero = 0;
	long long abzero = 0;
	for(long long i = 0; i < N; i++) {
		long long a = A[i];
		long long b = B[i];
		if(a < 0 && b < 0) {
			a = -a;
			b = -b;
		}
		long long g = gcd(a, b);
		if(a == 0 && b == 0) {
			abzero++;
			continue;
		} else if(a == 0) {
			azero++;
			continue;
		} else if(b == 0) {
			bzero++;
			continue;
		}
		a/=g;
		b/=g;

		memo[make_pair(a, b)]++;
	}
	long long ans = 1;
	if(abzero == N) {
		ans = 0;
	}

	//azeroからerabu もしくは bzeroから選ぶ
	ans *= (modpow(2, azero) - 1) + (modpow(2, bzero) - 1) + 1;
	ans = (ans + DIV)%DIV;

	set<pair<long long, long long> > done;
	for(auto item: memo) {
		long long a = item.first.first;
		long long b = item.first.second;
		long long num = item.second;

		if(done.count(make_pair(a, b)) > 0) {
			continue;
		}
		done.insert(make_pair(a, b));

		long long tmpans = 0;

		long long okpair = num;
		if(memo.count(make_pair(-a, -b)) > 0) {
			okpair += memo[make_pair(-a, -b)];
			done.insert(make_pair(-a, -b));
		}
		tmpans += modpow(2, okpair) - 1;

		long long ngpair = 0;
		if(memo.count(make_pair(-b, a)) > 0) {
			ngpair += memo[make_pair(-b, a)];
			done.insert(make_pair(-b, a));
		}
		if(memo.count(make_pair(b, -a)) > 0) {
			ngpair += memo[make_pair(b, -a)];
			done.insert(make_pair(b, -a));
		}
		tmpans += modpow(2, ngpair) - 1;

		ans *= (tmpans + 1);
		ans = (ans + DIV)%DIV;
	}

	ans--;
	ans = (ans + DIV)%DIV;
	ans += bothzero;
	ans = (ans + DIV)%DIV;
	cout << ans << endl;
}
