#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long double pi = 3.14159265358979323846;
const long double EPS = 1e-13;
long long pw[200010];
int main() {
  pw[0] = 1;
  for (int i = 1; i <= 200000; i++) {
    pw[i] = pw[i - 1] * 2 % mod;
  }
  int n;
  scanf("%d", &n);
  vector<long double> v1, v2, A, B;
  for (int i = 0; i < n; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    if (x != 0) {
      if (x > 0 && y > 0 || x < 0 && y < 0)
        v1.push_back((long double)y / x);
      else if (y != 0)
        v2.push_back((long double)y / x);
      else
        B.push_back(x);
    } else if (y != 0)
      A.push_back(y);
  }
  swap(v1, v2);
  long long ans = (pw[A.size()] + pw[B.size()] - 1 + mod) % mod;
  sort(v1.begin(), v1.end()), sort(v2.begin(), v2.end());
  int j = 0;
  for (int i = 0; i < v1.size();) {
    int ii = i;
    while (ii < v1.size() && fabs(v1[i] - v1[ii]) <= EPS) ii++;
    while (j < v2.size() && v2[j] + 1 / v1[i] + EPS < 0)
      ans = ans * 2 % mod, j++;
    int jj = j;
    while (jj < v2.size() && fabs(v2[jj] + 1 / v1[i]) <= EPS) jj++;
    ans = ans * (pw[ii - i] + pw[jj - j] - 1 + mod) % mod;
    i = ii, j = jj;
  }
  while (j < v2.size()) ans = ans * 2 % mod, j++;
  printf("%lld\n", (ans + mod - 1) % mod);
  return 0;
}
