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

int my_gcd(int n, int m){
    if(n < 0) n*=-1;
    if(m < 0) m*=-1;
    if(n < m) swap(n, m);
    if(m == 0) return n;
    else return my_gcd(m, n%m);
}

template<int MOD> struct modint{
    int val;
    constexpr modint(int v): val(v % MOD){
        if(val < 0) val += MOD;
    }
    constexpr int getmod(){
        return MOD;
    }
    constexpr modint operator-(){
        return val? MOD - val : 0; 
    }

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


    constexpr modint& operator+=(const modint &r){
        val += r.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    constexpr modint& operator-=(const modint& r){
        val -= r.val;
        if(val < 0) val += MOD;
        return *this;
    }
    constexpr modint& operator*=(const modint& r){
        val = (val * r.val) % MOD;
        return *this;
    }
    constexpr modint& operator/=(const modint& r){
        // ax + bz = a, ay + bw = b からスタートして
        // 右辺について互除法して係数を変えていく
        // (x, y) -> (y, x-y*(a/b)), (z, w) -> (w, z-w*(a/b))
        // 最終的に ax + bz = gcd(a, b) となるので a, b が互いに素なら x が逆元
        // z と w を覚えておく必要はない
        int a = r.val, b = MOD, x = 1, y = 0;
        while(b){
            x -= y * (a/b); swap(x, y);
            a -= b * (a/b); swap(a, b);
        }
        val = (val * x) % MOD;
        if(val < 0) val += MOD;
        return *this;
    }

    constexpr bool operator==(const modint& r){
        return val == r.val;
    }
    constexpr bool operator!=(const modint& r){
        return val != r.val;
    }

    constexpr modint modpow(int e){
        modint ans = 1, n = *this;
        while(e){
            if(e & 1) ans *= n;
            n *= n;
            e /= 2;
        }
        return ans;
    }

    friend constexpr ostream& operator<<(ostream &os, const modint<MOD>& x){
        return os << x.val;
    }
};

const int MOD = 1000000007;
using mint = modint<MOD>;


signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
    }

    map<pair<int, int>, int> mp;
    int aho = 0;
    for(int i=0; i<n; i++){
        if(a[i] != 0 && b[i] == 0){
            if(mp.find(make_pair(1,0)) != mp.end()){
                mp[make_pair(1,0)]++;
            }
            else mp[make_pair(1,0)] = 1;
        }
        else if(a[i] == 0 && b[i] != 0){
            if(mp.find(make_pair(0,1)) != mp.end()){
                mp[make_pair(0,1)]++;
            }
            else mp[make_pair(0,1)] = 1;
        }
        else if(a[i] == 0 && b[i] == 0){
            aho++;
        }
        else{
            int g = my_gcd(a[i], b[i]);
            if(a[i] < 0){
                a[i] *= -1;
                b[i] *= -1;
            }
            pair<int, int> p = make_pair(a[i]/g, b[i]/g);
            if(mp.find(p) != mp.end()) mp[p]++;
            else mp[p] = 1;
        }
    }

    mint ans = 1;
    for(auto itr=mp.begin(); itr != mp.end(); itr++){
        pair<int, int> right;
        if(itr->first.second == 0){
            right = make_pair(0, 1);
        }
        if(itr->first.first == 0){
            right = make_pair(1, 0);
        }
        else if(itr->first.second > 0){
            right = make_pair(itr->first.second, itr->first.first * -1);
        }
        else{
            right = make_pair(itr->first.second * (-1), itr->first.first);
        }
        int m = 0;
        if(mp.find(right) != mp.end()){
            m = mp[right];
        }
        ans *=  mint(2).modpow(itr->second) + mint(2).modpow(m) - 1;
        if(m != 0) mp[right] = 0;
        itr->second = 0;
    }
    cout << ans - 1 + aho << endl;

    return 0;
}

Measured memory_bytes: 18600