#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1,l,M
#define rson rt<<1|1,M+1,r
#define PI acos(-1)
#define MM int M=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define fh(i,be,e) for(int i=head[be];~i;i=e[i].next)
#define fa(i,V) for(auto i:V)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) ((x+mo_num)%mo_num)
#define vc vector
#define vct vector<int>
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
#define umap unordered_map
#define P pair<int,int>
#define SET set<int>
#define mp map<int,int>
#define mk make_tuple
#define low lower_bound
#define upp upper_bound
#define yn(key) out(key?"YES":"NO")
#define in(i) i+1,i+1+n
#define im(i) i+1,i+1+m
#define bffs(i) __builtin_ffs(i)
#define bcount(i) __builtin_popcount(i)
#define bone(i) ((1<<i)-1)
using namespace std;
const int INF=LLONG_MAX/2;
const int dx[]={0,0,-1,1},dy[]={-1,1,0,0};//up down left right
const int maxn=1e6+1e5;
const int mo_num=1e9+7;
int n,m,t,a[maxn],b[maxn],ans;
int inv(int i) { if(i==1)return 1;return (mo_num-mo_num/i)*inv(mo_num%i)%mo_num; }//i在mod x的意义下的逆元
map<tuple<int,int,int>,P>have;
int Pow(int a,int b){//快速幂(取模数版)
    a%=mo_num;
    int ans = 1;
    while(b)
    {
        if(b&1)
            ans = (ans*a)%mo_num;
        a = (a*a)%mo_num;
        b/=2;
    }
    return ans%mo_num;
}
main()
{
    IOS
    cin>>n;
    fun(i)
    {
        int x,y;
        cin>>x>>y;
        if(!x && !y) {
            a[0]++;
            continue;
        }else if(!x) {
            have[mk(0,0,1)]={have[mk(0,0,1)].fi+1,have[mk(0,0,1)].se};
            continue;
        }else if(!y)
        {
            have[mk(0,0,1)]={have[mk(0,0,1)].fi,have[mk(0,0,1)].se+1};
            continue;
        }
        int g=__gcd(x,y);
        x/=g;
        y/=g;
        if(abs(x)==abs(y))
        {
            if(x*y>0)have[mk(abs(x),abs(y),1)]={have[mk(abs(x),abs(y),1)].fi+1,have[mk(abs(x),abs(y),1)].se};
            else have[mk(abs(x),abs(y),1)]={have[mk(abs(x),abs(y),1)].fi,have[mk(abs(x),abs(y),1)].se+1};
        } else if(abs(x)>abs(y))
        {
            have[mk(abs(x),abs(y),x*y)]={have[mk(abs(x),abs(y),x*y)].fi+1,have[mk(abs(x),abs(y),x*y)].se};
        }else{
            swap(x,y);
            have[mk(abs(x),abs(y),-x*y)]={have[mk(abs(x),abs(y),-x*y)].fi,have[mk(abs(x),abs(y),-x*y)].se+1};
        }
    }
    ans=1;
    fa(i,have)
    {
        int x=i.se.fi,y=i.se.se;
        int num;
        if(!x or !y) {
            num = x + y;
            ans=mod(ans*Pow(2,num));
        }else{
            ans=mod(ans*mod(Pow(2,x)+Pow(2,y)-1));
        }
    }
    out(mod(ans-1+a[0]))
    return 0;
}


Measured memory_bytes: 19168