#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll mult(ll a,ll b){
    return a*b%MOD;
}
ll fastpow(ll a, ll b){
    ll ans=1;
    for(;b>=1;b/=2){
        if(b&1)ans=mult(ans,a);
        a=mult(a,a);
    }
    return ans;
}
ll soma(ll a,ll b){
    if(a+b>MOD)return a+b-MOD;
    else return a+b;
}
ll subt(ll a,ll b){
    if(a-b<0)return a-b+MOD;
    else return a-b;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin>>n;
    map<pii,ll> cont;
    map<pii,ll> cont2;
    ll zz=0;
    rep(i,0,n){
        ll a,b;
        cin>>a>>b;
        if(a==0 && b==0)zz++;
        else if(a==0 || b==0){
            if(a!=0)a=1;
            if(b!=0)b=1;
            cont[{a,b}]++;
        }
        else {
            ll anta=abs(a);
            ll antb=abs(b);
            a/=__gcd(anta,antb);
            b/=__gcd(anta,antb);
            if(b<0 && a<0)a*=-1,b*=-1;
            cont[{a,b}]++;
            if(-b<0 && a<0)cont2[{b,-a}]++;
            else cont2[{-b,a}]++;
        }
    }
    ll ans=1;
    for(auto e: cont){
        if(e.F.F>0 && e.F.S!=0){
            ans = mult(ans,subt(soma(fastpow(2,e.S),fastpow(2,cont2[{e.F.F,e.F.S}])),1)); //// (2^x + 2^y - 1)total possibilities  of this group
        }
        else if(e.F.F==0 || e.F.S==0){
            if(e.F.F==1)ans = mult(ans,subt(soma(fastpow(2,e.S),fastpow(2,cont[{e.F.S,e.F.F}])),1));
            // cout<<e.S<<" "<<cont2[{e.F.F,e.F.S}]<<" "<<ans<<endl;
        }
    }
    ans=soma(ans,zz);
    cout<<ans-1<<'\n';
    return 0;   
}
