/*!enjoy karo yaar!*/

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

// ref: https://codeforces.com/blog/entry/77505?#comment-625118
// the change is in the way of calculating the final answer (from my previous submission)

#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)            // gives reduced form of "a/b"
{
    pii res;

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

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

    int g=abs(gcd(a,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;                // stores -Bi/Ai

    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)            // (0,0) can't be linked to any other element
        {
            ++cnt;
            continue;
        }

        tmp=get(-b,a);
        ++mp[tmp];
    }

    vector<pii> need;

    int lone=1,sath=1;
    for(auto c:mp)
    {
        if(c.S==0)
            continue;

        b=-c.F.F,a=c.F.S;
        tmp=get(a,b);

        if(mp.find(tmp)==mp.end())                              // lone -> it's complement doesn't exist
            lone=(lone*pw(2,c.S))%M;
        else
        {
            sath=(sath*f(pw(2,c.S)+pw(2,mp[tmp])))%M;           // sath -> complement exists
            mp[tmp]=0;
        }
    }

    int ans=(sath*lone)%M;
    ans=f(ans);                 // removing empty set
    ans=(ans+cnt)%M;            // for "(0,0)" ones
    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: 18748