#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2e5 + 5, Mod = 1e9 + 7;
typedef long long arr[Maxn];
long long Add(long long x, long long y) {
  return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x);
}
long long min(long long x, long long y) { return x < y ? x : y; }
long long max(long long x, long long y) { return x > y ? x : y; }
inline long long read() {
  register long long res = 0, sign = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  do {
    res = (res << 3) + (res << 1) + (ch ^ 48);
    ch = getchar();
  } while (isdigit(ch));
  return res * sign;
}
int n, A0, B0;
arr A, B;
long long ans, res, pw[Maxn];
struct str {
  int sign;
  long long A, B;
  bool operator<(str A1) const {
    if (sign != A1.sign) return sign == 1;
    return A * A1.B < A1.A * B;
  }
} tmp;
str Trans(long long x, long long y) {
  return (str){((x > 0) ^ (y > 0)) ? 1 : -1, abs(x), abs(y)};
}
map<str, int> S;
int main() {
  pw[0] = 1;
  for (register int i = 1; i <= 200000; i++) pw[i] = pw[i - 1] * 2 % Mod;
  cin >> n;
  for (register int i = 1; i <= n; i++) {
    A[i] = read();
    B[i] = read();
    if (!A[i] && !B[i]) {
      res++;
      i--;
      n--;
      continue;
    }
    if (!A[i])
      A0++;
    else if (!B[i])
      B0++;
    else
      S[Trans(A[i], B[i])]++;
  }
  ans = 1;
  register map<str, int>::iterator it;
  for (it = S.begin(); it != S.end(); it++) {
    tmp = it->first;
    if (it->second != -1) {
      ans =
          ans * Add(pw[it->second], pw[S[{-tmp.sign, tmp.B, tmp.A}]] - 1) % Mod;
      S[{-tmp.sign, tmp.B, tmp.A}] = -1;
    }
  }
  res--;
  cout << Add(ans * Add(pw[A0], pw[B0] - 1) % Mod, res);
  return 0;
}
