#include <bits/stdc++.h>
using namespace std;
long long int fun(long long int a, long long int b) {
  a %= 1000000007;
  long long int ans = 1;
  if (a == 0) ans = 0;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  map<long double, long long int> pos, neg;
  long long int zero = 0, inf = 0;
  long long int a[n], b[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 and b[i] == 0)
      continue;
    else if (a[i] == 0)
      zero++;
    else if (b[i] == 0)
      inf++;
    else {
      long double x = (long double)a[i] / b[i];
      if (x > 0)
        pos[x]++;
      else
        neg[x]++;
    }
  }
  long long int ans =
      (fun(2, zero) + fun(2, inf) - 1 + 1000000007) % 1000000007;
  for (auto &i : pos) {
    long double z = i.first;
    z = -1 / z;
    long long int q = 0;
    if (neg.find(z) != neg.end()) {
      q = (fun(2, neg[z]) - 1 + 1000000007) % 1000000007;
      neg[z] = 0;
    }
    long long int tans = (q + 1000000007 + fun(2, i.second)) % 1000000007;
    ans = (ans * tans) % 1000000007;
  }
  for (auto i : neg)
    if (i.second != 0) ans = (ans * fun(2, i.second)) % 1000000007;
  cout << (ans - 1 + 1000000007) % 1000000007 << endl;
}
