#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 10;
const long long mod = 1000000007;
int N;
long long a[MAX], b[MAX];
long long siz[MAX], rhs[MAX], col, vis[MAX];
long long f[MAX], num1, num2;
map<double, int> mp;
int main() {
  scanf("%d", &N);
  f[0] = 1;
  for (int i = 1; i <= N; i++) f[i] = 1ll * f[i - 1] * 2 % mod;
  for (int i = 0; i <= N; i++) f[i] = f[i] - 1;
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%lld%lld", a + i, b + i);
    if (a[i] == 0 && b[i] == 0)
      ans++;
    else if (a[i] == 0)
      num1++;
    else if (b[i] == 0)
      num2++;
    else {
      double now = 1.0 * a[i] / b[i], pre = -1.0 * b[i] / a[i];
      if (!mp.count(now)) {
        mp[now] = ++col;
        if (mp.count(pre)) rhs[col] = mp[pre], rhs[mp[pre]] = col;
      }
      siz[mp[now]]++;
    }
  }
  long long t = (f[num1] + f[num2] + 1) % mod;
  for (int i = 1; i <= col; i++)
    if (!vis[i]) {
      vis[i] = 1;
      if (rhs[i]) {
        vis[rhs[i]] = 1;
        t = t * ((1ll + (f[siz[i]] + f[siz[rhs[i]]]) % mod) % mod) % mod;
      } else
        t = t * ((1ll + f[siz[i]]) % mod) % mod;
    }
  ans = (ans + t) % mod;
  printf("%lld\n", (ans - 1 + mod) % mod);
  return 0;
}
