/*!enjoy karo yaar!*/

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

/*
    crux: -> Ai/Bi = -Bj/Aj
          -> existence of "complement"
          -> calculating subsets
*/

#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"
{
    if(b==0)
        return {1,0};

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

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

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

    return {a,b};
}

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;
    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())                              // complement doesn't exist
            lone=(lone*pw(2,c.S))%M;
        else                                                    // complement exists
        {
            need.pb({f(pw(2,c.S)),f(pw(2,mp[tmp]))});
            mp[tmp]=0;
        }
    }

    int ans=0;
    int temp,pre=1;
    for(auto c:need)                     // calculating the answer (figure this out!)
    {
        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+f(lone))%M;                // no. of subsets for the "lone" ones
    ans=(ans+cnt)%M;                    // no. of subsets for the "(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: 18752