#include <bits/stdc++.h>
using namespace std;
const int N = 1000007, M = 1e9 + 7, inf = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long pot[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  pot[0] = 1;
  for (int i = 1; i < N; i++) {
    pot[i] = pot[i - 1] * 2ll % M;
  }
  int n;
  cin >> n;
  map<pair<long long, long long>, int> cnt;
  int uno, dos, ambos;
  uno = 0, dos = 0, ambos = 0;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a * b == 0) {
      if (a == 0 and b == 0)
        ambos++;
      else if (a == 0)
        uno++;
      else
        dos++;
      continue;
    }
    int nega = 0;
    if (a < 0) {
      nega ^= 1;
      a = -a;
    }
    if (b < 0) {
      nega ^= 1;
      b = -b;
    }
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (nega) a = -a;
    cnt[{a, b}]++;
  }
  long long ans = 1;
  for (auto aux : cnt) {
    long long a, b;
    tie(a, b) = aux.first;
    if (a < 0 and cnt.count({b, -a})) continue;
    if (cnt.count({-b, a})) {
      ans = ans * ((pot[aux.second] + pot[cnt[{-b, a}]] - 1) % M) % M;
    } else {
      ans = ans * pot[aux.second];
    }
  }
  ans = ans * ((pot[uno] + pot[dos] - 1) % M) % M;
  cout << (ans + ambos - 1 + M) % M << '\n';
}
