#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = 4611686018427387903;
int ggcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  long long int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long int power(long long int x, long long int y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x % MOD;
  else if (y % 2 == 0) {
    long long int pow = power(x, y / 2);
    return (pow * pow) % MOD;
  } else {
    long long int pow = power(x, y / 2);
    return ((pow * pow) % MOD) * x % MOD;
  }
}
int main() {
  int n;
  cin >> n;
  vector<long long int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int az = 0, bz = 0;
  map<pair<long long int, long long int>, int> mpm, mpp;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 || b[i] == 0) {
      if (a[i] == 0)
        az++;
      else
        bz++;
    } else if (a[i] * b[i] > 0) {
      if (a[i] < 0) {
        a[i] *= -1;
        b[i] *= -1;
      }
      int g = ggcd(a[i], b[i]);
      a[i] /= g;
      b[i] /= g;
      mpp[{a[i], b[i]}]++;
    } else {
      if (a[i] < 0)
        a[i] *= -1;
      else
        b[i] *= -1;
      int g = ggcd(a[i], b[i]);
      a[i] /= g;
      b[i] /= g;
      mpm[{a[i], b[i]}]++;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    int no = 0;
    if (a[i] != 0 && b[i] != 0) {
      if ((a[i] < 0 && b[i] < 0) || (a[i] > 0 && b[i] > 0)) {
        mpp[{a[i], b[i]}]--;
        no = mpm[{b[i], a[i]}];
      } else {
        mpm[{a[i], b[i]}]--;
        no = mpp[{b[i], a[i]}];
      }
    } else {
      if (a[i] == 0 && b[i] == 0) {
        az--;
        bz--;
        no = n - i - 1;
      } else if (a[i] == 0) {
        az--;
        no = bz;
      } else {
        bz--;
        no = az;
      }
    }
    ans += power(2, n - i - 1 - no);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
