#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
#define fastio cin.tie(0); cin.sync_with_stdio(0);
#define MOD 1000000007
#define MAXN 200005

int N;
ll res = 1,power[MAXN];
map<pair<ll,ll>,int> cnt;
vector<pair<ll,ll>> v;

int main(){
    fastio; cin >> N;
    power[0] = 1;
    for(int i=1; i<=N; i++){
        ll a,b,g; cin >> a >> b;
        g = abs(__gcd(a,b));
        if(a < 0 && b < 0) g = -g;
        if(a) a/=g;
        if(b) b/=g;
        cnt[mp(a,b)]++;
        v.pb(mp(abs(a),abs(b)));
        v.pb(mp(abs(b),abs(a)));
        power[i] = power[i-1]*2%MOD;
    }
    sort(v.begin(),v.end());
    v.resize(unique(v.begin(),v.end())-v.begin());
    for(pair<ll,ll> check:v){
        ll val = power[cnt[mp(check.second,-check.first)]]*power[cnt[mp(-check.second,check.first)]]%MOD;
        val = (val+power[cnt[check]]-1+MOD)%MOD;
        res = res*val%MOD;
    }
    cout << (res-1+MOD)%MOD << '\n';
}