#include <bits/stdc++.h>
using namespace std;
long long Mul(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
}
long long square(long long x) { return (x * x) % 1000000007; }
long long power(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x % 1000000007;
  else if (y % 2 == 0)
    return square(power(x, y / 2)) % 1000000007;
  else
    return square(power(x, y / 2)) * x % 1000000007;
}
long long gcd(long long a, long long b) {
  if (a < b)
    return gcd(b, a);
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
map<pair<long long, long long>, long long> mp;
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long A[200010], B[200010];
  long long k = 0;
  for (long long i = 0; i < n; i++) cin >> A[i] >> B[i];
  for (long long i = 0; i < n; i++) {
    if (A[i] == 0 && B[i] == 0) {
      k++;
      continue;
    }
    if (B[i] < 0) {
      A[i] = -A[i];
      B[i] = -B[i];
    }
    if (A[i] == 0 && B[i] != 0) {
      mp[{0, 1}]++;
      continue;
    } else if (A[i] != 0 && B[i] == 0) {
      mp[{1, 0}]++;
      continue;
    }
    long long G = gcd(abs(A[i]), B[i]);
    A[i] /= G;
    B[i] /= G;
    mp[{A[i], B[i]}]++;
  }
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    pair<long long, long long> p;
    if (A[i] < 0) {
      p = make_pair(B[i], -A[i]);
    } else {
      p = make_pair(-B[i], A[i]);
    }
    long long c1 = mp[{A[i], B[i]}], c2 = mp[p];
    if (c1 == 0 && c2 == 0) continue;
    long long c = (power(2, c1) + power(2, c2) - 1 + 1000000007) % 1000000007;
    ans = Mul(ans, c);
    mp[{A[i], B[i]}] = 0;
    mp[p] = 0;
  }
  cout << (ans + 1000000007 - 1 + k) % 1000000007 << endl;
  return 0;
}
