#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, b;
  vector<pair<int, int> > gr;
  int zero = 0;
  for (int i = 0; i < n; i++) {
    long double x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
    } else if (x == 0) {
      if (gr.size() == 0) {
        gr.push_back({1, 0});
      } else
        gr[0].first++;
    } else if (y == 0) {
      if (gr.size() == 0) {
        gr.push_back({0, 1});
      } else
        gr[0].second++;
    } else {
      a.push_back(x / y);
      b.push_back(-y / x);
    }
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int an = a.size();
  int bn = b.size();
  int rem = 0;
  if (gr.size()) {
    rem = gr[0].first + gr[1].second;
  }
  int l = 0, r = 0;
  while (l < an && r < bn) {
    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 < an && a[l] == cur) {
        cnta++;
        l++;
      }
      while (r < bn && b[r] == cur) {
        cntb++;
        r++;
      }
      gr.push_back({cnta, cntb});
      rem += cnta + cntb;
    }
  }
  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, bp(2, rem));
  cout << add(sub(ans, 1), zero);
}
