#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

#define MOD 1000000007

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main()
{
    int n;
    long long a[200005];
    long long b[200005];
    vector<pair<long long,int>> c;
    vector<pair<long long,int>> d;
    int nox = 0;
    int xno = 0;
    int nono = 0;
    
    cin >> n;
    for (int i = 0;i < n;i++){
        cin >> a[i] >> b[i];
        if (a[i] == 0 && b[i] == 0){
            nono++;
        }
        else if (a[i] == 0 && b[i] != 0){
            nox++;
        }
        else if (a[i] != 0 && b[i] == 0){
            xno++;
        }
        else if (a[i]*b[i] > 0){
            c.push_back({a[i]/b[i],i});
        }
        else {
            cout << a[i];
            a[i] = -a[i];
            d.push_back({b[i]/a[i],i});
            cout << a[i];
        }
    }
    
    long long res = 0;
    res += nono*(n-1);
    res += nox*xno;
    
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    for (long long i = 0;i < c.size();i++){
        for (auto iter = lower_bound(d.begin(),d.end(),c[i].first);iter < upper_bound(d.begin(),d.end(),c[i].first);iter++){
            if (a[c[i].second]*a[iter->second] == b[c[i].second]*b[iter->second]){
                res++;
            }
        }
    }
    
    long long ans;
    
    if (modpow(2,n,MOD)-res >= 0){
        ans = modpow(2,n,MOD)-res;
    }
    else {
        ans = modpow(2,n,MOD)-res+MOD;
    }
    
    cout << ans << endl;
    
}
