#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll N;
map<P,P> AA;
ll ans=1;
ll gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
ll M = 1000000007;
ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll anss = 1;
    while(n != 0){
        if(n&1) anss = anss*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return anss;
}


int main(){
    cin >> N;
    ll zeros=0;
    for(int i=0;i<N;i++){
        ll A,B;
        cin >> A >> B;
        if(A==0&&B==0){
            zeros++;
            continue;
        }
        ll n = gcd(abs(A),abs(B));
        A = A/n;
        B = B/n;
            if(B<0){
                B = -B;
                A = -A;
            }else if(B==0){
                A = 1;
            }
            if(A==0){
                B = 1;
            }
            if(A>0){
                AA[P(A,B)].first += 1;
            }else{
                AA[P(B,-A)].second += 1;
            }
    }
    for(auto p:AA){
        ans = (ans * (mpow(2,AA[p.first].first) + mpow(2,AA[p.first].second) - 1)%M)%M;
    }
    ans = (ans + zeros -1)%M;
    cout << ans << endl;