#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
const int MAX = 200000;
long long pow2[MAX];

void prepare(){
    pow2[0] = 1;
    for(int i = 1; i < MAX; i++){
        pow2[i] = pow2[i-1]*2;
    }
}

pair<long long,long long> kbs(long long a, long long b){  //既約分数kbs
    long long g = abs(__gcd(a,b));
    if(a*b>= 0){
        return make_pair(abs(a)/g,abs(b)/g);
    }
    else{
        return make_pair(-abs(a)/g,abs(b)/g);
    }
}
long long sign(long long n){
    if(n > 0) return 1;
    return -1;
}

int main(){
    prepare();
    long long N;
    cin >> N;
    map<pair<long long,long long>,long long> num;
    map<pair<long long,long long>,int> used;
    vector<pair<long long,long long>> ABs;
    for(int i =0; i < N; i++){
        long long a,b;
        cin >> a >> b;
        if( a!= 0 || b!= 0){
            pair<long long,long long> p;
            p = kbs(a,b);
            num[p]++;
            ABs.push_back(p);
        }
    }
    if(ABs.size() == 0) cout << 0 << endl;
    long long ans = 1;
    for(auto p:ABs){
        if(used[p])continue;
        long long a = p.first;
        long long b = p.second;
        pair<long long,long long> q;
        if(a >= 0){
            q = make_pair(-b,a);
        }
        else q = make_pair(b, -a);
        used[p] = 1;
        used[q] = 1;
        ans *= pow2[num[p]] + pow2[num[q]] - 1;
        ans %= MOD;
    }
    ans--;
    cout << ans%MOD << endl;    
}