#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll mod = 1e9+7;
//const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    map<P,ll> m;
    ll azero=0, bzero=0, bothzero=0;
    rep(i,n){
        ll a,b;cin>>a>>b;
        if(a==0&&b==0)bothzero++;
        else if(a==0)azero++;
        else if(b==0)bzero++;
        else{
            ll g = __gcd(a,b);
            a/=g;b/=g;
            //if(a<0){a*=-1;b*=-1;}
            m[{a,b}]++;
        }


    }
    mint ans = 1;
    map<P,int> used;
    for(pair<P,ll> p:m){
        if(used[p.first]==1)continue;
        ll a = p.first.first;
        ll b = p.first.second;
        P p1 = {a,b};
        P p2 = {-a,-b};


        P q1,q2;
        q1 = {b,-a};
        q2 ={-b,a};
        ans *= (mint(2).pow(m[p1]+m[p2])+mint(2).pow(m[q1]+m[q2])-1);
        used[p1]=1;
        used[p2]=1;
        used[q1]=1;
        used[q2]=1;

    }
    ans*=mint(2).pow(azero)+mint(2).pow(bzero)-1;
    
    if(azero>0||bzero>0)cout<<"WA"<<endl;
    cout<<(ans-1).x<<endl;
    return 0;
}