#include<bits/stdc++.h>
using namespace std;
#define MAXN 200005
#define ll long long
map<pair<ll,ll>,pair<ll,ll>>k;
const ll mod=1000000007;
ll qpow(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b&1)res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
int main()
{
    //cout<<3/__gcd(0,3)<<endl;
    int n;
    scanf("%d",&n);
    ll ans=mod-1;
    ll tmp=1;
    for(int i=1;i<=n;i++)
    {
        ll a,b;
        scanf("%lld%lld",&a,&b);
        if(a==0&&b==0)
        {
            ans=(ans+1)%mod;
        }
        else
        {
            if(a<0){a=-a,b=-b;}
            ll g = __gcd(abs(a),abs(b));
            a/=g;b/=g;
            if(a==0)
                k[{a,b}].first++;
            else if(b==0)
                k[{b,a}].second++;
            else if(b>0)
                k[{a,b}].first++;
            else
                k[{-b,a}].second++;
        }
    }
    for(auto it:k)
        tmp=tmp*((qpow(2,it.second.first)+qpow(2,it.second.second)-1)%mod)%mod;
    cout<<(ans+tmp)%mod<<endl;
}