// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const long long MOD = 1000000007;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}

template <i64 mod = MOD>
struct ModInt{
    i64 p;

    ModInt() : p(0){}
    ModInt(i64 x){p = x >= 0 ? x % mod : x + (-x + mod - 1) / mod * mod;}

    ModInt& operator+=(const ModInt& y){p = p + *y - ((p + *y) >= mod ? mod : 0); return *this;}
    ModInt& operator-=(const ModInt& y){p = p - *y + (p - *y < 0 ? mod : 0); return *this;}
    ModInt& operator*=(const ModInt& y){p = (p * *y) % mod; return *this;}
    ModInt& operator%=(const ModInt& y){if(y)p %= *y; return *this;}

    ModInt operator+(const ModInt& y) const{ModInt x = *this; return x += y;}
    ModInt operator-(const ModInt& y) const{ModInt x = *this; return x -= y;}
    ModInt operator*(const ModInt& y) const{ModInt x = *this; return x *= y;}
    ModInt operator%(const ModInt& y) const{ModInt x = *this; return x %= y;}

    friend ostream& operator<<(ostream& stream, const ModInt<mod>& x){
        stream << *x;
        return stream;
    }

    friend ostream& operator>>(ostream& stream, const ModInt<mod>& x){
        stream >> *x;
        return stream;
    }

    ModInt& operator++(){p = (p + 1) % mod; return *this;}
    ModInt& operator--(){p = (p - 1 + mod) % mod; return *this;}

    bool operator==(const ModInt& y) const{return p == *y;}
    bool operator!=(const ModInt& y) const{return p != *y;}

    const i64& operator*() const{return p;}
    i64& operator*(){return p;}

};

using mint = ModInt<>;

void solve(long long n, std::vector<long long> a, std::vector<long long> b){
    auto mpow = [](auto x, i64 y){
     auto z = x;
     decltype(x) val = y & 1 ? x : decltype(x)(1);
     while(z *= z, y >>= 1)
      if(y & 1)
       val *= z;
     return val;
    };

    map<pair<i64,i64>, int> div;
    i64 ab = 0;
    i64 aa = 0, bb = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] < 0)
            a[i] *= -1, b[i] *= -1;
        if(a[i] != 0 && b[i] != 0){
            i64 gc = gcd(abs(a[i]), abs(b[i]));
            a[i] /= gc;
            b[i] /= gc;
            ++div[make_pair(a[i], b[i])];
        }
        else if(a[i] == 0 && b[i] == 0){
            ++ab;
        }
        else if(a[i] == 0){
            ++aa;
        }
        else if(b[i] == 0){
            ++bb;
        }
    }

    mint ans = 1;
    auto f = [&](i64 cnt, i64 cnt2){
        // 2個以上選んで絡まれる
        mint c1 = mpow(mint(2), cnt) - (cnt + 1);
        mint c2 = mpow(mint(2), cnt2) - (cnt2 + 1);
        mint c3 = cnt + cnt2 + 1;

        ans *= c1 + c2 + c3;
    };
    for(auto it = div.begin(); it != div.end();){
        i64 x, y;
        i64 cnt = it->second;
        tie(x, y) = it->first;
        assert(x >= 0);
        i64 vx, vy;
        if(y > 0){
            vx = y;
            vy = -x;
        }
        else{
            vx = -y;
            vy = x;
        }
        i64 cnt2 = div[make_pair(vx, vy)];
        f(cnt, cnt2);

        div.erase(make_pair(vx, vy));
        it = div.erase(it);
    }
    f(aa, bb);
    cout << ans + ab - 1 << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 18744