#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long mod = 1000000007, ans, p[N];
int n, x, y, cnt;
float s[N], a[N], b[N];
bool vis[N];
map<float, int> m;
bool c(float s) {
  s = max(s, -s);
  return s < 0.001;
}
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 (c(a[i]) && c(b[i])) {
      cnt += 1;
      i--, n--;
      continue;
    }
    if (c(a[i])) {
      x++;
      i--, n--;
      continue;
    }
    if (c(b[i])) {
      y++;
      i--, n--;
      continue;
    }
    s[i] = a[i] / b[i];
    if (!m[s[i]] && !m[-1.0 / 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.0 / s[i]]] - 1) % mod) % mod;
  }
  cout << (ans + cnt - 1) % mod << endl;
  return 0;
}
