#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int add(int x, int y) { return (x + y) % MOD; }
int sub(int x, int y) { return add(x, MOD - y); }
int mul(int x, int y) { return (x * 1ll * y) % MOD; }
int bp(int x, int y) {
  if (!x) return x;
  int ans = 1;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long double> a(n), b(n);
  for (int i = 0; i < n; i++) {
    long double x, y;
    cin >> x >> y;
    if (y == 0)
      a[i] = 0;
    else
      a[i] = x / y;
    if (x == 0)
      b[i] = 0;
    else
      b[i] = -(y / x);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  vector<pair<int, int> > gr;
  int rem = 0;
  int l = 0, r = 0;
  while (l < n && r < n) {
    if (a[l] >= 0 || b[r] >= 0) break;
    if (a[l] != b[r]) {
      if (a[l] < b[r])
        l++;
      else
        r++;
    } else {
      long double cur = a[l];
      int cnta = 0, cntb = 0;
      while (l < n && a[l] == cur) {
        cnta++;
        l++;
      }
      while (r < n && b[r] == cur) {
        cntb++;
        r++;
      }
      gr.push_back({cnta, cntb});
      rem += cnta + cntb;
    }
  }
  int zero = 0;
  if (a[l] == 0) {
    while (l < n && a[l] == 0) {
      l++;
      zero++;
    }
  } else if (a[r] == 0) {
    while (r < n && b[r] == 0) {
      r++;
      zero++;
    }
  }
  rem = n - (rem + zero);
  int m = gr.size();
  vector<int> dp(m + 1);
  dp[0] = 1;
  for (int i = 0; i < m; i++) {
    dp[i + 1] = add(dp[i + 1], dp[i]);
    dp[i + 1] = add(dp[i + 1], mul(dp[i], sub(bp(2, gr[i].first), 1)));
    dp[i + 1] = add(dp[i + 1], mul(dp[i], sub(bp(2, gr[i].second), 1)));
  }
  int ans = dp[m];
  ans = mul(ans, zero + 1);
  ans = mul(ans, bp(2, rem));
  cout << sub(ans, 1);
}
