#include <bits/stdc++.h>
using namespace std;
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long INF = 1LL << 62;
const long long MOD = 1e9 + 7;
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s) {
  return f.second > s.second;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long conbinationMemo[100][100];
void cmemoInit() {
  for (int i = 0; i < (int)(100); i++) {
    for (int j = 0; j < (int)(100); j++) {
      conbinationMemo[i][j] = -1;
    }
  }
}
long long nCr(long long n, long long r) {
  if (conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
  if (r == 0 || r == n) {
    return 1;
  } else if (r == 1) {
    return n;
  }
  return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
long long nPr(long long n, long long r) {
  r = n - r;
  long long ret = 1;
  for (long long i = n; i >= r + 1; i--) ret *= i;
  return ret;
}
long long modpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res *= a;
      res %= MOD;
    }
    a *= a;
    a %= MOD;
    b >>= 1;
  }
  return res;
}
int main(void) {
  long long n;
  cin >> n;
  long long zz = 0;
  long long zw = 0;
  long long wz = 0;
  map<pair<pair<long long, long long>, int>, long long> mp;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zz++;
    } else if (a == 0) {
      zw++;
    } else if (b == 0) {
      wz++;
    } else {
      int sign = 0;
      if (a > 0 && b > 0 || a < 0 && b < 0) {
        sign = 1;
      } else {
        sign = 0;
      }
      long long g = gcd(abs(a), abs(b));
      long long aa = abs(a) / g;
      long long bb = abs(b) / g;
      mp[{{aa, bb}, sign}]++;
    }
  }
  map<pair<pair<long long, long long>, int>, int> checked;
  long long ans = 1;
  for (auto& i : mp) {
    pair<pair<long long, long long>, int> rev = {
        {i.first.first.second, i.first.first.first}, !i.first.second};
    if (checked.find(i.first) != checked.end()) {
      continue;
    }
    checked[rev] = 1;
    long long tmp = modpow(2LL, i.second) % MOD;
    tmp += modpow(2LL, mp[rev]);
    tmp %= MOD;
    tmp -= 1;
    while (tmp < 0) tmp += MOD;
    tmp %= MOD;
    ans *= tmp;
    ans %= MOD;
  }
  long long tmp = modpow(2LL, zw);
  tmp %= MOD;
  tmp += modpow(2LL, wz);
  tmp -= 1;
  while (tmp < 0) tmp += MOD;
  tmp %= MOD;
  ans *= tmp;
  ans -= 1;
  while (ans < 0) ans += MOD;
  ans %= MOD;
  cout << ans << endl;
}
