/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

int pw(int x,int n,int mod=M)
{
    int res=1;

    x%=mod;
    for(;n;n/=2)
    {
        if(n%2)
            res=(res*x)%mod;

        x=(x*x)%mod;
    }

    return res;
}

pii get(int a,int b)
{
    pii res;

    if(b==0)
    {
        res={1,0};
        return res;
    }

    if(a==0)
    {
        res={0,1};
        return res;
    }

    int g=abs(gcd(abs(a),abs(b)));
    a/=g;
    b/=g;

    if(b<0)
        a*=-1,b*=-1;

    res={a,b};
    return res;
}

int f(int x)
{
    int res=(x-1ll+M)%M;
    return res;
}

void solve()
{
    int n;
    cin>>n;

    vector<pii> v(n);
    for(int i=0;i<n;++i)
        cin>>v[i].F>>v[i].S;

    map<pii,int> mp;
    vector<pii> ab,ba;

    pii tmp;
    int a,b;

    int cnt=0;
    for(int i=0;i<n;++i)
    {
        a=v[i].F,b=v[i].S;

        if(a==0 && b==0)
        {
            ++cnt;
            continue;
        }

        tmp=get(-b,a);
        ba.pb(tmp);
        ++mp[tmp];

        tmp=get(a,b);
        ab.pb(tmp);
    }

//    for(auto c:ab)
//        cout<<"("<<c.F<<","<<c.S<<")"<<" ";
//    cout<<"\n";
//    for(auto c:ba)
//        cout<<"("<<c.F<<","<<c.S<<")"<<" ";
//    cout<<"\n";

    set<pii> st;
    vector<pii> need;

    int lone=1;
    for(auto c:mp)
    {
        b=-c.F.F,a=c.F.S;

        tmp=get(a,b);

        //cout<<tmp.F<<" "<<tmp.S<<"\n";

        if(mp.find(tmp)==mp.end())
            lone=(lone*pw(2,c.S))%M;
        else if(st.find(tmp)==st.end())
        {
            //cout<<-b<<" "<<a<<"\n";
            //cout<<c.S<<" "<<mp[tmp]<<"......\n";

            need.pb({f(pw(2,c.S)),f(pw(2,mp[tmp]))});

        }

        st.ins(c.F);
    }

    //cout<<lone<<"\n";

    int ans=0;
    int temp,pre=1;
    for(auto c:need)
    {
        temp=(lone*pre)%M;
        ans=(ans+(temp*((c.F+c.S)%M))%M)%M;

        pre=(pre*((c.F+c.S+1ll)%M))%M;
    }

    ans=(ans+(lone-1ll+M)%M)%M;
    ans=(ans+cnt)%M;

    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 37500