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

long long modpow(long long U){
    
    long long ans = 1;
    while(U>0){
        ans*=2;
        ans %= 1000000007;
        U--;
    }
    return ans;
    
}


int main() {
    
    int N;
    cin >> N;
    long long A,B;
    long long zero = 0;
    map<pair<long long, long long>,long long> mp;
    pair<long long,long long> Azero = make_pair(0,-1);
    pair<long long,long long> Bzero = make_pair(1,0);
    pair<long long,long long> pr;
    vector<pair<long long,long long>> vec;
    for(int i = 0; i < N;i++){
        cin >> A >> B;
        if(A==0&&B==0){
            zero++;
            continue;
        }else if(A == 0){
            mp[Azero]++;
            vec.push_back(Azero);
            continue;
        }else if(B == 0){
            mp[Bzero]++;
            vec.push_back(Bzero);
            continue;
        }else{
            long long g = gcd(A, B);
            if(A<0)g *= -1;
            pr = make_pair(A/g,B/g);
            mp[pr]++;
            vec.push_back(pr);
        }
    }
    //sort(vec.begin(),vec.end());
    //vec.erase(unique(vec.begin(), vec.end()), vec.end());
    //cout << vec.size() <<endl;
    map<pair<long long, long long>,long long> end;
    pair<long long, long long> u;
    long long U = 0;
    long long V = 0;
    long long ans = 1;
    for(auto v:vec){
        if(v.second<=0){
            u = make_pair( -v.second,v.first);
        }else{
            u = make_pair( v.second,-v.first);
        }
        
        if(end[v]==0){
            U = mp[u];
            V = mp[v];
            // cout << u.first <<" "<<u.second<<" "<<U<<endl;
            // cout << v.first <<" "<<v.second<<" "<<V<<endl;            
            // cout <<  (modpow(U)-1) + (modpow(V)-1) + 1 <<endl;
            ans *= (modpow(U)-1)+(modpow(V)-1)+1;
            ans %= 1000000007;
            end[u]++;
            end[v]++;
        }
    }
    zero %= 1000000007;
    cout << ((ans + zero)% 1000000007 - 1)% 1000000007<<endl;
    
}
