#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;

vector<int> ra(MX,0);
vector<int> par(MX,0);
using P = pair<int, int>;
using ll = long long;
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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int find(int x) {
    if(par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x==y) return;
    if(ra[x]<ra[y]) {
        par[x] = y;
    }else {
        par[y] = x;
        if(ra[x]==ra[y]) {
            ra[x]++;
            
        }
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

signed main(){
    int n;
    cin >> n;
    
    map<P,P> mp;
    int zero = 0;
    rep(i,n) {
        int x, y;
        cin >> x >> y;
        
        if(x==0 && y == 0) {
            zero++;
            continue;
        }
        
        int g = __gcd(x,y);
        x = x/g;
        y = y/g;

        if(y<0) x = -x, y = -y; 
        if(y == 0 && x < 0) x = -x, y = -y;
        bool rot90 = (x<=0);
        if(rot90) {
            double tmp = x;
            x = y; y = -tmp;
        }
    
        if(rot90) mp[{x,y}].first++;
        else mp[{x,y}].second++;
    }

    mint ans = 1;
    for(auto p:mp) {
        int s = p.second.first;
        int t = p.second.second;
        mint now = 1; // 何も選ばない
        now += mint(2).pow(s) - 1; //sだけ選ぶ
        now += mint(2).pow(t) - 1; //tだけ選ぶ
        ans *= now;
    }
    ans -= 1; // 誰も選ばない

    ans += zero;
    cout << ans << endl;
    
    return 0;
}

