#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

template<long long mod>
struct modint{
    long long num;

    constexpr modint(long long x = 0) : num((x + mod) % mod) {}

    constexpr modint &operator += (const modint& rhs){
        num = (num + rhs.num) % mod;
        return *this;
    }
    constexpr modint &operator -= (const modint& rhs){
        num  -= rhs.num;
        while(num < 0) num += mod;
        num %= mod;
        return *this;
    }
    constexpr modint &operator *= (const modint& rhs){
        num = num * rhs.num % mod;
        return *this;
    }
    constexpr modint &operator /= (modint rhs){
        int exp = mod - 2;
        while(exp > 0){
            if(exp % 2){
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }

    constexpr modint operator ++ (){
        ++num;
        return *this;
    }
    constexpr modint operator ++ (int n){
        modint tmp = *this;
        ++(*this);
        return tmp;
    }
    constexpr modint operator -- (){
        --num;
        return *this;
    }
    constexpr modint operator -- (int n){
        const modint tmp = *this;
        --(*this);
        return tmp;
    }

    void modpow(ll y){
        modint tmp = (*this);
        (*this) = 1;
        while(y > 0){
            if(y % 2){
                (*this) *= tmp;
            }
            tmp *= tmp;
            y /= 2;
        }
    }

    constexpr modint operator + (const modint& rhs) const {
        return modint(*this) += rhs;
    }
    constexpr modint operator - (const modint& rhs) const {
        return modint(*this) -= rhs;
    }
    constexpr modint operator * (const modint& rhs) const {
        return modint(*this) *= rhs;
    }
    constexpr modint operator / (const modint& rhs) const {
        return modint(*this) /= rhs;
    }

    
    friend ostream &operator << (ostream& lhs, const modint& rhs){
        return lhs << rhs.num;
    }

    friend istream &operator >> (istream& lhs, modint& rhs){
        long long tmp;
        lhs >> rhs.num;
        return lhs;
    }
};

#define mint modint<1000000007>

mint modpow(mint x, int y){
    if(y == 0) return 1;
    mint e = modpow(x, y / 2);
    e = e * e;
    return e * (y % 2 == 0 ? 1 : x);
}

int cnt[2];
int N;
ll A[200010], B[200010];
map<pll, ll> mp;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    for(int i = 0; i < N; ++i){
        cin >> A[i] >> B[i];
        if(A[i] == 0){
            if(B[i] != 0){
                mp[pll(1, 0)]++;
                B[i] = 1;
            }else{
                mp[pll(0, 0)]++;
            }
        }else if(B[i] == 0){
            A[i] = 1;
            mp[pll(0, 1)]++;
        }else{
            ll d = __gcd(abs(A[i]), abs(B[i]));
            A[i] /= d, B[i] /= d;
            mp[pll(B[i], A[i])]++;
        }
    }
    mint ans = 1;
    for(int i = 0; i < N; ++i){
        if(mp[pll(B[i], A[i])] == 0) continue;
        if(A[i] == 0 && B[i] == 0){
            ans *= mp[pll(B[i], A[i])] + 1;
            mp[pll(B[i], A[i])] = 0;
            continue;
        }
        int gr1 = mp[pll(B[i], A[i])] + mp[pll(-B[i], -A[i])];
        int gr2 = mp[pll(-A[i], B[i])] + mp[pll(A[i], -B[i])];
        mp[pll(-A[i], B[i])] = 0;
        mp[pll(A[i], -B[i])] = 0;
        mp[pll(-B[i], -A[i])] = 0;
        mp[pll(B[i], A[i])] = 0;
        ans = ans * (modpow(2, gr1) + modpow(2, gr2) - 1);
    }
    cout << ans - 1 << endl;
    return 0;
}