#include <bits/stdc++.h>
using namespace std;
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);
}
long long modpow(long long a, long long n, long long mod = 1000000007) {
  long long res = 1;
  for (long long i = 0; i < n; i++) {
    res *= a;
    res %= mod;
  }
  return res;
}
long long sign(long long n) {
  if (n >= 0) {
    return 1;
  } else {
    return -1;
  }
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> cnt;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt[make_pair(0, 0)]++;
    } else if (a == 0 && b != 0) {
      cnt[make_pair(0, 1)]++;
    } else if (a != 0 && b == 0) {
      cnt[make_pair(1, 0)]++;
    } else {
      long long g = gcd(abs(a), abs(b));
      long long sig = sign(a * b);
      cnt[make_pair(sig * abs(a) / g, abs(b) / g)]++;
    }
  }
  long long int ccc = n - cnt[make_pair(0LL, 0LL)];
  long long int ans = 1;
  for (auto it = cnt.begin(); it != cnt.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 = cnt[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 %= 1000000007;
    }
    long long int cq = 1;
    for (long long int i = 0; i < q; i++) {
      cq *= 2;
      cq %= 1000000007;
    }
    ans *= (cp + cq - 1);
    ans %= 1000000007;
    ccc -= p + q;
    (*it).second = 0;
    cnt[make_pair(ddx, ddy)] = 0;
  }
  for (long long int i = 0; i < ccc; i++) {
    ans *= 2;
    ans %= 1000000007;
  }
  cout << (cnt[make_pair(0, 0)] + ans - 1 + 1000000007) % 1000000007 << endl;
}
