#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
const int mo = 1000000000 + 7;
int n, m;
long long a[maxn], b[maxn], p[maxn];
map<pair<long long, long long>, int> mp;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && b[i] == 0) continue;
    m++;
    long long x = abs(a[i]);
    long long y = abs(b[i]);
    long long g = gcd(x, y);
    a[i] /= g;
    b[i] /= g;
    if (a[i] < 0) a[i] = -a[i], b[i] = -b[i];
    pair<long long, long long> pir = make_pair(a[i], b[i]);
    mp[pir]++;
  }
  int w = n - m;
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2ll % mo;
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && b[i] == 0) continue;
    long long x = -b[i];
    long long y = a[i];
    if (x < 0) x = -x, y = -y;
    pair<long long, long long> pir = make_pair(a[i], b[i]);
    int k1 = mp[pir];
    mp[pir] = 0;
    pir = make_pair(x, y);
    int k2 = mp[pir];
    mp[pir] = 0;
    printf("...%d %d %lld\n", k1, k2, p[k1] + p[k2] - 1);
    ans = ans * (p[k1] + p[k2] - 1) % mo;
  }
  ans = (ans - 1 + w + mo) % mo;
  printf("%lld\n", ans);
  return 0;
}
