#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
long long int gcd2(long long int a, long long int b) {
  if ((a % b) == 0) return b;
  return gcd2(b, a % b);
}
long long int gcd(long long int a, long long int b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a == 0) {
    if (b == 0) return 1;
    return b;
  }
  if (b == 0) return a;
  return gcd2(a, b);
}
int main() {
  long long int n;
  cin >> n;
  map<pair<long long int, long long int>, long long int> m;
  long long int zero = 0;
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (a == 0 && b < 0) b *= -1;
    long long int g = gcd(a, b);
    a /= g;
    b /= g;
    m[make_pair(a, b)]++;
  }
  long long int cnt = n - zero;
  long long int ans = 1;
  for (auto it = m.begin(); it != m.end(); ++it) {
    long long int dx = (*it).first.first;
    long long int dy = (*it).first.second;
    long long int p = (*it).second;
    if (p == 0) continue;
    long long int ddx = dy;
    long long int ddy = -dx;
    if (ddx < 0) {
      ddx *= -1;
      ddy *= -1;
    }
    if (ddx == 0 && ddy < 0) ddy *= -1;
    long long int q = m[make_pair(ddx, ddy)];
    if (q == 0) continue;
    long long int cp = 1;
    for (long long int i = 0; i < p; i++) {
      cp *= 2;
      cp %= MOD;
    }
    long long int cq = 1;
    for (long long int i = 0; i < q; i++) {
      cq *= 2;
      cq %= MOD;
    }
    ans *= (cp + cq - 1);
    ans %= MOD;
    cnt -= p + q;
    (*it).second = 0;
    m[make_pair(ddx, ddy)] = 0;
  }
  for (long long int i = 0; i < cnt; i++) {
    ans *= 2;
    ans %= MOD;
  }
  ans += zero;
  ans %= MOD;
  cout << ans - 1 << endl;
  return 0;
}
