#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0};
long double eps = 1e-9;


const int mod = 1000000007;



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    ll a[n],b[n];
    ll beki[n+1]={};
    beki[0] = 1;
    for(int i=0;i<n;i++){
        beki[i+1] = beki[i] * 2;
        beki[i+1] %= mod;
    }
    ll ans = 1;
    ll cnt = 0;
    map<array<ll,2>,ll> mp;
    ll l=0,r=0;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]==0 && b[i]==0){
            cnt++;
            continue;
        }
        if(a[i]==0){
            l++;
            continue;
        }
        if(b[i]==0){
            r++;
            continue;
        }
        ll g = max(1LL,gcd(abs(a[i]),abs(b[i])));
        a[i] /= g;
        b[i] /= g;
        if(a[i]<0 && b[i]<0){
            a[i] = -a[i];
            b[i] = -b[i];
        }
        if(b[i] < 0 && a[i] > 0){
            a[i] = -a[i];
            b[i] = -b[i];
        }
        mp[{a[i],b[i]}]++;
    }
    map<array<ll,2>,bool> used;

    for(auto i:mp){
        if(used[i.first])continue;
        ll ret = beki[i.second];
        array<ll,2> now = i.first;
        used[now] = 1;
        if(mp.count({-now[1],now[0]}) || mp.count({now[1],-now[0]})){
            used[{-now[1],now[0]}] = 1;
            used[{now[1],-now[0]}] = 1;
            ll tmp = 0;
            if(mp.count({-now[1],now[0]}))tmp=mp[{-now[1],now[0]}];
            if(mp.count({now[1],-now[0]}))tmp+=mp[{now[1],-now[0]}];
            ret += beki[tmp];
            ret += mod-1;
            ret %= mod;
        }
        ans *= ret;
        ans %= mod;
    }
    ans += cnt;
    ans %= mod;
    ll ret = beki[l] + beki[r];
    ret %= mod;
    ret += mod-1;
    ret %= mod;
    ans *= ret;
    ans %= mod;
    ans += mod-1;
    ans %= mod;
    cout << ans << endl;
    // 0 に注意


}