#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
map<pair<ll,ll>,int> mp;
int n,zero;
int quick_pow(int x,int y)
{
    int ans=1;
    while(y)
	{
        if(y & 1) ans=(ll)ans*x % mod;
        y>>=1;
        x=(ll)x*x%mod;
    }
    return ans;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
	{
		ll a,b;
		scanf("%lld%lld", &a,&b);
        ll d=__gcd(a, b);
        if(d==0) {zero++;continue;}
		a/=d,b/=d;
        if(a<0) a=-a,b=-b;
        mp[{a, b}]++;
    }
    ll ans=1;
    for(auto it : mp)
	{
        if(it.second==0) continue;
        ll a=it.first.first,b=it.first.second;
        ll d=quick_pow(2, mp[{a, b}]);
        b=-b;
        if(b<0) a=-a,b=-b;
        if(mp.count({b, a}))
		{
            d=(d+quick_pow(2,mp[{b, a}])-1)%mod;
            mp[{b,a}] = 0;
        }
        ans=ans*d%mod;
    }
    ans=(ans-1+zero+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}
E.cpp