#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
map<pair<long long, long long>, pair<int, int>> mp;
map<pair<long long, long long>, pair<int, int>>::iterator iter;
long long er[200050];
long long S(long long m, long long n) {
  if (m == 1) return 1;
  if (m == n)
    return 1;
  else
    return S(m - 1, n - 1) + S(m, n - 1) * m;
}
int main(int argc, char *argv[]) {
  register int n, i, ct = 0;
  long long A, B, g, fh, ans = 1;
  scanf("%d", &n);
  for (er[0] = i = 1; i <= n; i++) er[i] = (er[i - 1] * 2) % 1000000007;
  for (i = 1; i <= n; i++) {
    scanf("%lld %lld", &A, &B);
    g = gcd(A, B);
    if (A == 0 || B == 0) {
      if (A == 0 && B == 0) {
        ct++;
      } else if (B == 0) {
        mp[make_pair(1, 0)].second++;
      } else {
        mp[make_pair(0, 1)].second++;
      }
    } else {
      fh = (A / abs(A)) * (B / abs(B));
      A = abs(A / g);
      B = abs(B / g);
      if (fh < 0) {
        mp[make_pair(B, A)].second++;
      } else {
        mp[make_pair(A, B)].first++;
      }
    }
  }
  iter = mp.begin();
  if (er[iter->second.first - 1] == 0)
    ans =
        (er[iter->second.first - 1] * er[iter->second.second - 1]) % 1000000007;
  long long sum = 0;
  n = er[iter->second.first];
  for (i = 1; i <= n; i++) sum += S(i, n);
  ans = sum;
  sum = 0;
  n = er[iter->second.second];
  for (i = 1; i <= n; i++) sum += S(i, n);
  ans = (ans * sum) % 1000000007;
  iter++;
  for (; iter != mp.end(); iter++) {
    ans = (ans * ((er[iter->second.first] + er[iter->second.second] - 1) %
                  1000000007)) %
          1000000007;
  }
  ans = (ans) % 1000000007;
  printf("%lld", ans - 1);
  return 0;
}
