#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
ll gcd(ll a,ll b){
    return (b?gcd(b,a%b):a);
}
class mint{
    public:
        long long x;
 
    constexpr mint(long long _x = 0) : x((_x%mod+mod)%mod) {}
    constexpr mint operator-() const{
        return mint(-x);
    }
    constexpr mint& operator+=(const mint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a){
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const{
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const{
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const{
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long x) const{
        if(!x) return 1;
        mint a = pow(x>>1);
        a *= a;
        if(x&1) a *= *this;
        return a; 
    }
    constexpr mint inv() const{
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a){
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const{
        mint res(*this);
        return res/=a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x; return os;
    }
};
mint pow_mod(ll n,ll k,ll m){
  ll res=1;
  for(;k>0;k>>=1){
    if(k&1){
      res=(res*n)%m;
    }
    n=(n*n)%m;  
  }
  return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];
    map<pair<ll,ll>,ll> mp;
    ll az=0,bz=0,z=0;
    for(int i=0;i<n;i++){
        if(a[i]==0&&b[i]==0){
            z++;
        }
        else if(a[i]==0){
            az++;
        }
        else if(b[i]==0){
            bz++;
        }
        else{
            ll t=gcd(abs(a[i]),abs(b[i]));
            if(a[i]<0){
                a[i]=-a[i];
                b[i]=-b[i];
            }
            a[i]/=t;
            b[i]/=t;
            mp[{a[i],b[i]}]++;
        }
    }
    mint ans=pow_mod(2,az,mod)+pow_mod(2,bz,mod)-1;
    for(int i=0;i<n;i++){
        if(a[i]==0||b[i]==0){
            continue;
        }
        else{
            if(mp[{a[i],b[i]}]>0){
                ll u,v;
                if(b[i]>0){
                    u=b[i],v=-a[i];
                }
                else{
                    u=-b[i],v=a[i];
                }
                ans*=pow_mod(2,mp[{a[i],b[i]}],mod)+pow_mod(2,mp[{u,v}],mod)-1;
                mp[{a[i],b[i]}]=0;
                mp[{u,v}]=0;
            }
        }
    }
    ans-=1;
    ans+=z;
    cout << ans << endl;
}

Measured memory_bytes: 31280