#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ff first
#define ss second
long double pi = 3.14159265359 ;
const int N=2e5+5;
const int mod=1e9+7;
 
int binpow(int a, int b, int m) {
    a %= m;
    b %=m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int a[N],b[N],dp[N];
map<pair<int,int>,int> pos,neg;
int zero;
int check(int x,int y)
{
    if(x>0 && y>0)
        return 1;
    if(x<0 && y<0)
        return 1;
    if(x==0 && y==0)
        return 0;
    if(x==0)
        return 2;
    if(y==0)
        return 3;
    return -1;    
}
int32_t main()
{
    IOS;
    
    int n;
    cin>>n;
    int x=0,y=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
        int val=check(a[i],b[i]);
        a[i]=abs(a[i]);
        b[i]=abs(b[i]);
        if(val==0)
        {
            zero++;
            continue;
        }
        if(val==2)
        {
            x++;
            continue;
        }
        if(val==3)
        {
            y++;
            continue;
        }
        int gc=__gcd(a[i],b[i]);
        a[i]/=gc;
        b[i]/=gc;
        if(val>0)
            pos[{a[i],b[i]}]++;
        else
            neg[{a[i],b[i]}]++;
    }
    vector<pair<int,int>> v;
    for(auto &it:pos)
    {
        if(neg[{it.ff.ss,it.ff.ff}])
            v.push_back({it.ss,neg[{it.ff.ss,it.ff.ff}]});
    }
    int ans=1;
    int lt=0;
    for(auto &it:v)
    {
        int x=it.ff;
        int y=it.ss;
        int temp=binpow(2,x,mod);
        temp%=mod;
        temp+=binpow(2,y,mod);
        temp%=mod;
        temp-=1;
        temp+=mod;
        temp%=mod;
        ans*=temp;
        ans%=mod;
        lt+=x;
        lt+=y;
    }
    lt+=zero;
    lt=n-lt;
    ans*=binpow(2,lt,mod);
    ans%=mod;
    ans*=(binpow(2,x,mod)+binpow(2,y,mod)-1+mod)%mod;
    ans%=mod;
    ans-=1;
    ans+=mod;
    ans%=mod;
    ans+=(zero);
    ans%=mod;
    cout<<ans;
}
