#include <bits/stdc++.h>
using namespace std;

const int N = 200005;

const int MOD = 1000000007;

using Sardine = pair<long long, long long>;

int n;
Sardine sar[N];

long long gcd(long long x, long long y) {
  while (y) {
    long long t = x;
    x = y;
    y = t % y;
  }
  return x;
}

long long Abs(long long x) {
  return x < 0 ? -x : x;
}

void simplify(Sardine &s) {
  long long g = gcd(Abs(s.first), Abs(s.second));
  s.first /= g, s.second /= g;
  if (s.second < 0 || (s.second == 0 && s.first < 0)) {
    s.first *= -1;
    s.second *= -1;
  }
}

map<Sardine, int> cnt;

int power(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1) {
    if (y & 1) ret = 1LL * ret * x % MOD;
    x = 1LL * x * x % MOD;
  }
  return ret;
}

int solve() {
  scanf("%d", &n);
  int ans = 1;

  int zero = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%lld %lld", &sar[i].first, &sar[i].second);
    if (sar[i].first == 0 && sar[i].second == 0) {
      ++zero;
    } else {
      simplify(sar[i]);
      cnt[sar[i]] += 1;
    }
  }

  set<Sardine> s;
  for (int i = 0; i < n; ++i) {
    if (s.find(sar[i])) continue;
    s.insert(sar[i]);
    if (sar[i] == make_pair(0LL, 0LL));
    else {
      Sardine bad = Sardine(sar[i].second, -sar[i].first);
      Sardine bad2 = Sardine(-sar[i].second, sar[i].first);
      if (cnt[bad2] == 0) {
        ans = 1LL * ans * (power(2, cnt[sar[i]]) + power(2, cnt[bad]) - 1) % MOD;
        // cerr << sar[i].first << " " << sar[i].second << " " << ans << endl;
      }
    }
  }

  ans -= 1;
  ans += zero;

  ans %= MOD;
  if (ans < 0) ans += MOD;
  printf("%d\n", ans);
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    // printf("Case #%d: ", tc+1);
    solve();
  }
  return 0;
}
