#include <bits/stdc++.h>
using namespace std;
 
#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

class fraction {
public:
    ll first, second;
    fraction(ll N, ll D){
        if(N==0 && D==0){
            first = second = 0;
            return;
        }else if(N == -1 && D == 0){
            first = 1;
            second = 0;
            return;
        }
        ll g = gcd(abs(N),abs(D));
        if(D < 0) g = -g;
        first = N / g; second = D / g;
    }
    
    string to_string() const{
        return std::to_string(this->first)+"/"+std::to_string(this->second);
    }
    
    bool operator <(const fraction other) const {
        if(this->first == other.first){
            return this->second < other.second;
        }else{
            return this->first < other.first;
        }
        //return this->r * other.d < this->d * other.r;
    }
    
    bool operator >(const fraction other) const {
        if(this->first == other.first){
            return this->second > other.second;
        }else{
            return this->first > other.first;
        }
        //return this->r * other.d > this->d * other.r;
    }
    
    bool operator ==(const fraction other) const {
        return this->first == other.first && this->second == other.second;
    }
};

int modpow(int a, int n){
    int ret = 1;
    while(n>0){
        if(n&1) ret = (ret*a) % MOD;
        a = (a*a) % MOD;
        n >>= 1;
    }
    return ret;
}

signed main() {
    ifstream in("input.txt"); cin.rdbuf(in.rdbuf());
    int n; cin >> n;
    int zero_iwashi = 0;
    vector<intpair> iwashi;
    rep(i,n){
        int A, B;
        cin >> A >> B;
        if(A==0 && B==0){
            zero_iwashi++;
            continue;
        }
        iwashi.push_back({A,B});
    }
    map<fraction,int> adb;
    
    for(auto [A,B] : iwashi){
        adb[fraction(A,B)]++;
    }
    
    ll ans = 1;
    for(auto [p,cnt] : adb){
        if(cnt == 0) continue;
        ll tmp = 1;
        auto [A,B] = p;
        int dnt = adb[fraction(-B,A)];
        adb[fraction(-B,A)] = 0;
        adb[p] = 0;
        tmp += modpow(2, cnt)-1;
        tmp += modpow(2, dnt)-1;
        ans = mod(ans * tmp);
    }
    ans = mod(ans -1 + zero_iwashi);
    
    cout << ans << endl;
}