#include <bits/stdc++.h>
using namespace std;
const long long inf = 1020304050607080910;
const int mod = 1000000007;
template <class T>
bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
long long gcd(long long x, long long y) {
  if (x > y) swap(x, y);
  while (x != 0) {
    y %= x;
    swap(x, y);
  }
  return y;
}
long long mpow(long long x, long long r) {
  if (r == 0) return 1;
  if (r % 2 == 1) {
    return x * mpow(x, r - 1) % mod;
  } else {
    long long aa = mpow(x, r / 2);
    return aa * aa % mod;
  }
}
long long tw[300000];
int main() {
  int N;
  cin >> N;
  long long A[N], B[N], s = 0;
  tw[0] = 1;
  for (int i = 1; i < 300000; i++) tw[i] = (tw[i - 1] * 2) % mod;
  vector<pair<pair<long long, long long>, long long> > arr;
  for (long long i = 0; i < (long long)(N); i++) {
    int ff;
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      s++;
      continue;
    }
    if (A[i] == 0) {
      if (B[i] < 0)
        ff = 2;
      else
        ff = 0;
      arr.push_back({{0, 1}, ff});
      continue;
    }
    if (B[i] == 0) {
      if (A[i] < 0)
        ff = 1;
      else
        ff = 3;
      arr.push_back({{0, 1}, ff});
      continue;
    }
    if (A[i] < 0) {
      if (B[i] < 0)
        ff = 2;
      else {
        ff = 1;
        swap(A[i], B[i]);
      }
    } else {
      if (B[i] < 0) {
        ff = 3;
        swap(A[i], B[i]);
      } else
        ff = 0;
    }
    if (A[i] < 0) A[i] = -A[i];
    if (B[i] < 0) B[i] = -B[i];
    long long g = gcd(A[i], B[i]);
    A[i] /= g;
    B[i] /= g;
    arr.push_back({{A[i], B[i]}, ff});
  }
  sort((arr).begin(), (arr).end());
  long long ans = 1;
  pair<long long, long long> now;
  vector<long long> c(4, 0);
  for (long long i = 0; i < (long long)(arr.size() + 1); i++) {
    int ff = arr[i].second;
    if (i == arr.size()) {
      long long cnt = 1;
      for (long long x = 0; x < (long long)(4); x++)
        cnt = (cnt + tw[c[x]] + mod - 1) % mod;
      for (long long x = 0; x < (long long)(2); x++)
        cnt = (cnt + (tw[c[x]] + mod - 1) * (tw[c[x + 2]] - 1) % mod) % mod;
      ans = (ans * cnt) % mod;
      break;
    }
    if (i == 0) {
      now = arr[i].first;
      c[ff]++;
    } else {
      if (now != arr[i].first) {
        long long cnt = 1;
        for (long long x = 0; x < (long long)(4); x++)
          cnt = (cnt + tw[c[x]] + mod - 1) % mod;
        for (long long x = 0; x < (long long)(2); x++)
          cnt = (cnt + (tw[c[x]] + mod - 1) * (tw[c[x + 2]] + mod - 1) % mod) %
                mod;
        ans = (ans * cnt) % mod;
        now = arr[i].first;
        for (long long y = 0; y < (long long)(4); y++) c[y] = 0;
        c[ff]++;
      } else {
        c[ff]++;
      }
    }
  }
  cout << (ans + s + mod - 1) % mod << endl;
  return 0;
}
