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

typedef long long ll;
typedef unsigned long long ull;

class ModInt{
public:
    ModInt(){
        x = 0;
    }
    ModInt(int v){
        x = (((v % mod) + mod) % mod);
    }
    ModInt(long long v){
        x = (((v % mod) + mod) % mod);
    }
    ModInt(unsigned long long v){
        x = (((v % mod) + mod) % mod);
    }

    ModInt operator-() const {return ModInt(-x);}
    ModInt& operator+=(const ModInt& a){
        x = (x + a.x) % mod;
        return *this;
    }
    ModInt& operator-=(const ModInt& a){
        x = (x + mod - a.x) % mod;
        return *this;
    }
    ModInt& operator*=(const ModInt& a){
        x = (x * a.x) % mod;
        return *this;
    }
    ModInt operator+(const ModInt& a) const{
        ModInt res(*this);
        res += a;
        return res;
    }
    ModInt operator-(const ModInt& a) const{
        ModInt res(*this);
        res -= a;
        return res;
    }
    ModInt operator*(const ModInt& a) const{
        ModInt res(*this);
        res *= a;
        return res;
    }
    ModInt power(long long a) const{
        if(a == 0) return 1;
        auto b = power(a >> 1);
        b *= b;
        if(a & 1) b *= *this;
        return b;
    }
    ModInt inverse() const{
        return power(mod - 2);
    }
    ModInt& operator/=(const ModInt& a){
        (*this) *= a.inverse();
        return *this;
    }
    ModInt operator/(const ModInt& a)const{
        ModInt res(*this);
        res /= a;
        return res;
    }
    friend ostream& operator<<(ostream& os, const ModInt& a){
        os << a.x;
        return os;
    }

    static ModInt add(long long a, long long b){
        ModInt res(a);
        res += b;
        return res;
    }

    static long long get_mod(){ return mod;}

private:
    static const long long mod = 1000000007;
    long long x;
};

template <typename T>
T gcd( T m, T n ){
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;

    while( m != n ){
        if ( m > n ) m %= n;
        else         n %= m;

        if(m == 0) return n;
        if(n == 0) return m;
    }
    return m;
}

int main()
{
    ll N;
    cin >> N;
    ll Ai, Bi;
    map<array<ll,2>, ll> AB;
    for(int i=0;i<N;i++){
        cin >> Ai >> Bi;
        if     (Ai == 0 && Bi == 0){}
        else if(Ai == 0){Bi = 1;}
        else if(Bi == 0){Ai = 1;}
        else{
            auto v = gcd(abs(Ai), abs(Bi));
            Ai /= v;
            Bi /= v;
        }
        if(Ai < 0){ Ai *= -1; Bi *= -1;}
        auto e = array<ll,2>{Ai, Bi};
        if(AB.count(e) == 0) AB[e] = 0;
        AB[e]++;
    }
    vector<array<ll, 2>> group;
    ll others = 0;
    set<array<ll, 2>> done;
    ll zeros = 0;
    for(auto m : AB){
        if(done.count(m.first)>0) continue;
        if(m.first[0] == 0 && m.first[1] == 0){
            zeros = m.second;
            continue;
        }
        array<ll, 2> bad;
        if(m.first[0] == 0 && m.first[1] == 0){
            bad[0] = 0;
            bad[1] = 0;
        }else if(m.first[0] == 0){
            bad[0] = 1;
            bad[1] = 0;
        }else if(m.first[1] == 0){
            bad[0] = 0;
            bad[1] = 1;
        }else{
            bad[0] = m.first[1];
            bad[1] = -m.first[0];
        }
        if(bad[0]<0) { bad[0] *= -1; bad[1] *= -1;}
        if(AB.count(bad) > 0){
            done.insert(bad);
            group.push_back(array<ll, 2>{m.second, AB[bad]});
        }else{
            others += m.second;
        }
        done.insert(m.first);
    }
    ModInt res(0);
    res += ModInt(2).power(others);
    for(auto v : group){
        res *= ModInt(2).power(v[0]) + ModInt(2).power(v[1]) - 1;
    }
    res += zeros;
    cout << res-1 << endl;

    return 0;
}


Measured memory_bytes: 28604