#include <bits/stdc++.h>
#define MOD 1000000007
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define pii pair<long long, long long>
using namespace std;

int N;
map<pii, int> slope;
set<pii> vis;
int cntzer1, cntzer2;
int memo[5005][5005];

long long GCD(long long A, long long B) {
  return B == 0 ? A : GCD(B, A % B);
}

long long POW(long long X, long long Y) {
  long long res = 1;
  while(Y) {
    if(Y & 1) res = res * X % MOD;
    X = X * X % MOD;
    Y >>= 1;
  }
  return res;
}

void frac(long long A, long long B) {
  long long gcd = GCD(ABS(A), ABS(B));
  slope[make_pair(A / gcd, B / gcd)]++;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  long long A, B;
  for(int i = 1; i <= N; i++) {
    cin >> A >> B;
    if((A == 0) && (B == 0)) continue;
    if(A == 0) {
      cntzer1++;
    }else if(B == 0) {
      cntzer2++;
    }else frac(A, B);
  }
  long long ans = 1; 
  while(!slope.empty()) {
    long long x = slope.begin()->first, y = slope.begin().second;
    long long val1 = 0, val2 = 0;
    val1 += slope.begin()->second;
    if(slope.count(make_pair(y, -x))) {
      val2 += slope[make_pair(y, -x)];
      slope.erase(make_pair(y, -x));
    }
    if(slope.count(make_pair(-y, x))) {
      val2 += slope[make_pair(-y, x)];
      slope.erase(make_pair(-y, x));
    }
    if(slope.count(make_pair(-x, -y))) {
      val1 += slope[make_pair(-x, -y)];
      slope.erase(make_pair(-x, -y));
    }
    ans = ans * (POW(2, val1) + POW(2, val2) - 1) % MOD;
  }
  ans = ans * (POW(2, cntzer1) + POW(2, cntzer2) - 1) % MOD;
  cout << ans - 1 << "\n";
}