#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll MAX_N = 234567;
ll MOD = ll(1000000000+7);
ll fac2[MAX_N];

void init(){
    fac2[0] = 1ll;
    for(int i=1;i<MAX_N;i++){
        fac2[i] = (fac2[i-1]*2ll)%MOD;
    }
}

int main(void)
{
    init();
    ll N;
    cin >> N;
    map<pair<ll, ll>, pair<int, int>> umap;
    pair<int, int> zpair = {0, 0};
    ll zero = 0;
    for(int i=0;i<N;i++){
        ll a, b;
        cin >> a >> b;
        if(a==0 && b==0){
            zero++;
            continue;
        }
        if(a==0){
            zpair.first++;
            continue;
        }
        if (b==0){
            zpair.second++;
            continue;
        }
        ll d = gcd(abs(a), abs(b));
        a /= d;
        b /= d;
        if(a<0){
            a = -a;
            b = -b;
        }
        if(b>0){
            umap[{a, b}].first += 1;
        }else{
            umap[{-b, a}].second += 1;
        }
    }
    ll answer = (fac2[zpair.first] + fac2[zpair.second] - 1ll) % MOD;
    for(auto item:umap){
        answer *= (fac2[item.second.first]+fac2[item.second.second]-1ll) % MOD;
        answer %= MOD;
    }
    cout << (answer - 1ll + zero) % MOD << endl;

    return 0;
}