#include <bits/stdc++.h>
using namespace ::std;
const long double PI = acos(-1);
const long long MOD = 1000000000 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long add(long long a, long long b, long long m = MOD) {
  if (a >= m) a %= m;
  if (b >= m) b %= m;
  if (a < 0) a += m;
  if (b < 0) b += m;
  long long res = a + b;
  if (res >= m or res <= -m) res %= m;
  if (res < 0) res += m;
  return res;
}
long long mul(long long a, long long b, long long m = MOD) {
  if (a >= m) a %= m;
  if (b >= m) b %= m;
  if (a < 0) a += m;
  if (b < 0) b += m;
  long long res = a * b;
  if (res >= m or res <= -m) res %= m;
  if (res < 0) res += m;
  return res;
}
long long pow_mod(long long a, long long b, long long m = MOD) {
  long long res = 1LL;
  a = a % m;
  while (b) {
    if (b & 1) res = mul(res, a, m);
    b >>= 1;
    a = mul(a, a, m);
  }
  return res;
}
long long fastexp(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a;
    b >>= 1;
    a *= a;
  }
  return res;
}
int gcdExtendido(int a, int b, int *x, int *y) {
  if (a == 0) {
    *x = 0;
    *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtendido(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
int modInverso(int a, int m) {
  int x, y;
  int g = gcdExtendido(a, m, &x, &y);
  if (g != 1)
    return -1;
  else
    return (x % m + m) % m;
}
int n;
set<pair<long long, long long> > vis;
map<pair<long long, long long>, int> F;
int main() {
  scanf("%d", &(n));
  int ans = 1;
  int zeroes = 0;
  for (int i = 1; i <= n; i++) {
    long long x, y;
    scanf("%lld %lld", &(x), &(y));
    if (x < 0) {
      x = -x;
      y = -y;
    } else if (x == 0) {
      y = 1;
    }
    if (y == 0) {
      x = 1;
    }
    long long mcd = gcd(abs(x), abs(y));
    if (mcd) {
      x /= mcd;
      y /= mcd;
    }
    if (make_pair(x, y) == make_pair(0LL, 0LL)) {
      zeroes += 1;
    } else {
      F[make_pair(x, y)] += 1;
    }
  }
  for (auto e : F) {
    long long x = e.first.first;
    long long y = e.first.second;
    if (vis.count(e.first)) continue;
    vis.emplace(e.first);
    long long nx = -y;
    long long ny = x;
    if (nx < 0) {
      nx = -nx;
      ny = -ny;
    } else if (nx == 0) {
      ny = 1;
    }
    if (ny == 0) {
      nx = 1;
    }
    int cur = add(pow_mod(2, e.second),
                  add(pow_mod(2, F[make_pair(nx, ny)]), MOD - 1));
    ans = mul(ans, cur);
    vis.emplace(make_pair(nx, ny));
  }
  ans = add(ans, zeroes);
  ans = add(ans, MOD - 1);
  printf("%d\n", ans);
  return 0;
}
