#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 1000000007;
long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); }
long long p2[N];
long long ans = 1;
void f(long long &a, long long &b) {
  long long g = gcd(abs(a), abs(b));
  if (g == 0) return;
  a /= g;
  b /= g;
  if (b < 0) {
    a = -a;
    b = -b;
  }
  if (a < 0) {
    a = -a;
    b = -b;
  }
}
pair<long long, long long> D(pair<long long, long long> a) {
  return pair<long long, long long>(a.second, -a.first);
}
map<pair<long long, long long>, int> ct;
map<pair<long long, long long>, int> vis;
int main() {
  int n;
  scanf("%d", &n);
  p2[0] = 1ll;
  for (int i = 1; i <= n; i++) {
    p2[i] = (p2[i - 1] * 2) % mod;
  }
  for (int i = 0; i < n; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    f(a, b);
    ct[pair<long long, long long>(a, b)]++;
  }
  for (auto it : ct) {
    pair<long long, long long> k = it.first;
    if (vis[it.first]) continue;
    if (k.first == 0 && k.second == 0) {
      continue;
    }
    printf("have vector %lld %lld\n", k.first, k.second);
    k = D(k);
    f(k.first, k.second);
    int s1 = it.second, s2 = ct[k];
    ans *= (p2[s1] + p2[s2] - 1);
    ans %= mod;
    vis[it.first] = vis[k] = 1;
  }
  ans += ct[pair<long long, long long>(0, 0)];
  ans = (ans + mod - 1) % mod;
  printf("%lld", ans);
}
