#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int n;
const int maxn = 2e5 + 5;
long long a[maxn], b[maxn];
map<pair<long long, long long>, int> cnt, vis;
int power[maxn];
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  int C = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 and b[i] == 0) {
      C++;
      continue;
    }
    long long A = abs(a[i]), B = abs(b[i]);
    long long g = gcd(A, B);
    a[i] /= g;
    b[i] /= g;
    if (a[i] < 0 or (a[i] == 0 and b[i] < 0)) {
      a[i] = -a[i];
      b[i] = -b[i];
    }
    cnt[make_pair(a[i], b[i])]++;
  }
  power[0] = 1;
  for (int i = 1; i <= n; i++) {
    power[i] = power[i - 1] * 2 % mod;
  }
  int ans = 1;
  for (auto p : cnt) {
    if (vis.count(p.first)) continue;
    int cnt1 = p.second;
    int x = p.first.first;
    int y = p.first.second;
    pair<int, int> to;
    if (y > 0)
      to = make_pair(y, -x);
    else
      to = make_pair(-y, x);
    int cnt2 = cnt[to];
    int tmp = (power[cnt1] + power[cnt2]) % mod;
    tmp = (tmp + mod - 1) % mod;
    ans = 1LL * ans * tmp % mod;
    vis[p.first] = true;
    vis[to] = true;
  }
  ans = (ans + mod - 1) % mod;
  ans = (ans + C) % mod;
  cout << ans << endl;
  return 0;
}
