#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mod 1000000007
ll binpow(ll a, ll b, ll m=mod) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],b[n];
    for(int x=0;x<n;x++)
        cin>>a[x]>>b[x];
    map<pair<ll,ll>,ll> ae;
    ll d=1;
    ll f=0;
    for(int x=0;x<n;x++)
    {         ll r=__gcd(abs(a[x]),abs(b[x]));
               a[x]/=r;
               b[x]/=r;
               if((a[x]<=0 && b[x]<=0) || (a[x]>=0 && b[x]>=0))
               {
                   a[x]=abs(a[x]);
                   b[x]=abs(b[x]);
               }
               else
               {
                   a[x]=-abs(a[x]);
                   b[x]=abs(b[x]);
               }
            ++ae[{a[x],b[x]}];
    }
    ll j=0;
    set<pair<ll,ll>> aw;
    for(auto it : ae)
    {   ll w;
        ll we=1;
        aw.insert(it.first);
        pair<ll,ll> r;
        if(it.first.first>0)
        r={-it.first.second,it.first.first};
        else
        {
           r={it.first.second,-it.first.first};
        }
        if(aw.count(r))
           continue;
         w=ae[r];
        we=binpow(2,it.second+w);
        we-=(((mod+binpow(2,it.second)-1)*(mod+binpow(2,w)-1))%mod)%mod;
        we=(mod+we)%mod;
        d*=we;
        d%=mod;
    }
   // cout<<we<<"\n";
    d%=mod;
    d=(mod+d-1)%mod;
    cout<<d<<"\n";
}
