//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define ff              first
#define ss              second
#define SZ(x)           ((int)(x).size())
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
ll mod =            1000000007;
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

ll zeroCnt;

ll power(ll a, ll b){
    if(b==0){
        return 1;
    }
    else if(b%2==0){
        return power((a%mod)*(a%mod)%mod, (b/2))%mod;
    }
    return (a*power(a, b-1))%mod;
}

pair<ll, ll> normalize(ll a, ll b){
    if(a==0){
        return {0, 1};
    }
    else if(b==0){
        return {1, 0};
    }
    else{
        if(((a<0)&&(b>0)) || ((a>0)&&(b<0))){
            a = llabs(a);
            b = llabs(b);
            ll gcd = __gcd(a, b);
            a/=gcd;
            b/=gcd;
            return {-a, b};
        }
        else{
            a = llabs(a);
            b = llabs(b);
            ll gcd = __gcd(a, b);
            a/=gcd;
            b/=gcd;
            return {a, b};
        }
    }
}

int main(){
    cpp();
    ll n;
    cin>>n;
    zeroCnt = 0;
    map<pair<ll, ll>, ll> mapp;
    for(ll i=0; i<n; i++){
        ll a, b;
        cin>>a>>b;
        if((a==0)&&(b==0)){
            zeroCnt++;
            continue;
        }
        pair<ll, ll> nor = normalize(a, b);
        mapp[{nor.first, nor.second}]++;
    }
    ll ans = 1;
    for(auto it: mapp){
        if(it.second==0) continue;
        ll a = it.first.first;
        ll b = it.first.second;
        ll currFreq = it.second;
        ll temp = power(2, currFreq);
        if((a==0)&&(b==1)){
            auto it1 = mapp.find({1, 0});
            if(it1!=mapp.end()){
                temp= ((temp + power(2, it1->second)-1)%mod+mod)%mod;
                mapp[it1->first] = 0;
            }
        }
        else if((a==1)&&(b==0)){
            auto it1 = mapp.find({0, 1});
            if(it1!=mapp.end()){
                temp= ((temp + power(2, it1->second)-1)%mod+mod)%mod;
                mapp[it1->first] = 0;
            }
        }
        else{
            if(((a<0)&&(b>0)) || ((a>0)&&(b<0))){
                auto it1 = mapp.find({llabs(b), llabs(a)});
                if(it1!=mapp.end()){
                    temp=((temp+power(2, it1->second)-1)%mod+mod)%mod;
                    mapp[it1->first] = 0;
                }
            }
            else{
                auto it1 = mapp.find({-b, a});
                if(it1!=mapp.end()){
                    temp= ((temp+power(2, it1->second)-1)%mod+mod)%mod;
                    mapp[it1->first] = 0;
                }
            }
        }
        ans = (ans*temp)%mod;
    }
    ans = ((ans - 1 + zeroCnt)%mod+mod)%mod;
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 16068