#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10, mod = 1e9 + 7, INF = 0x3f3f3f3f;
int add(int a, int b) {
  a += b;
  if (a < 0) return a + mod;
  return a >= mod ? a - mod : a;
}
int mul(long long a, long long b) { return a * b % mod; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
pair<long long, long long> hs(long long x, long long y) {
  long long g = gcd(abs(x), abs(y));
  x /= g;
  y /= g;
  if (x == 0) y = abs(y);
  if (y == 0) x = abs(x);
  if (x < 0) x = -x, y = -y;
  return make_pair(x, y);
}
long long a[maxn], b[maxn];
map<pair<long long, long long>, int> cnt, cnt2;
set<pair<long long, long long> > vis;
int kpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d%I64d", &a[i], &b[i]);
    cnt[hs(b[i], -a[i])]++;
    cnt2[hs(a[i], b[i])]++;
  }
  int ans = 1;
  for (auto it : cnt2) {
    if (vis.count(it.first)) continue;
    vis.insert(it.first);
    pair<long long, long long> t = hs(it.first.second, -it.first.first);
    vis.insert(t);
    int A = cnt[it.first], B = it.second;
    ans = mul(ans, add(add(kpow(2, A), kpow(2, B)), -1));
  }
  cout << add(add(ans, -1), cnt[make_pair(0, 0)]);
  return 0;
}
