#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long mod = 1000000007, ans, p[N];
int n, x, y, cnt, a[N], b[N];
long double s[N];
bool vis[N];
map<long double, int> m;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  cin >> n;
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (!a[i] && !b[i]) {
      cnt += 1;
      i--, n--;
      continue;
    }
    if (!a[i]) {
      x++;
      i--, n--;
      continue;
    }
    if (!b[i]) {
      y++;
      i--, n--;
      continue;
    }
    long long d = gcd(a[i], b[i]);
    a[i] /= d, b[i] /= d;
    s[i] = (long double)a[i] / (long double)b[i];
    if (!m[s[i]] && !m[-1.00000000000 / s[i]]) vis[i] = 1;
    m[s[i]]++;
  }
  ans = p[x] + p[y] - 1;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) continue;
    ans = ans * ((p[m[s[i]]] + p[m[-1.0000000000 / s[i]]] - 1) % mod) % mod;
  }
  cout << (ans + cnt - 1) % mod << endl;
  return 0;
}
