#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    int n;
    cin >> n;
    map<pair<ll,ll>,P> mp;
    int zero = 0;
    rep(i,n){
        ll x,y;
        cin >> x >> y;
        if(x==0&&y==0){
            zero++;
            continue;
        }
        ll g = gcd(x,y);
        x/=g;
        y/=g;
        if(y<0)x=-x,y=-y;
        if(y==0&&x>0)x=-x,y=-y;
        //first field or second field or zero
        if(x>0)mp[make_pair(x,y)].first++;
        else mp[make_pair(y,-x)].second++;
    }
    mint ans = 1;
    for(auto p:mp){
        int N = p.second.first;
        int M = p.second.second;
        //cout << N << " " << M << endl;
        mint res = mint(2).pow(N)-1+mint(2).pow(M)-1;
        res += 1;
        //cout << res << endl;
        ans *= res;
    }
    ans -= 1;
    ans += zero;
    cout << ans << endl;
}