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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;

ll fast_pow(ll a,ll n)
{
	ll ans = 1;
	while(n)
	{
		if(n&1)	ans = ans*a%MOD;
		a = a*a %MOD;
		n >>= 1;
	}
	return ans;
}
int main(int argc, char const *argv[])
{
	map<pair<ll,ll>,int>one;
	map<pair<ll,ll>,int>four;
	set<pair<ll,ll> >list;
	int n;
	scanf("%d",&n);
	ll ans = 1,ant = 0;
	ll a,b;
	for(register int _ = 0;_ < n;_++)
	{
		scanf("%lld%lld",&a,&b);
		ll ab_gcd = __gcd(abs(a),abs(b));
		if(!a&&!b)	ant++;
		if(a >= 0 && b > 0 || a <= 0 && b < 0)
		{
			a = abs(a)/ab_gcd;b = abs(b)/ab_gcd;
			one[{a,b}]++;
		}else{
			a = abs(a)/ab_gcd;b = abs(b)/ab_gcd;
			four[{b,a}]++;
		}
	}
	for(map<pair<ll,ll>,int>::iterator it = one.begin();it != one.end();it++)
		list.insert(it->first);
	for(map<pair<ll,ll>,int>::iterator it = four.begin();it != four.end();it++)
		list.insert(it->first);
	for(set<pair<ll,ll> >::iterator it = list.begin();it != list.end();it++)
		ans = ans*(fast_pow(2,one[*it])+fast_pow(2,four[*it])-1+MOD)%MOD;
	printf("%lld\n",(ans + ant - 1 + MOD)%MOD);
	return 0;
}