#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

const int M = (int) 1e9 + 7;

int add(int a, int b) {
  a += b;
  if (a >= M) {
    return a - M;
  }
  if (a < 0) {
    return a + M;
  }
  return a;
}

int mul(int a, int b) {
  return a * (ll) b % M;
}

int pw(int a, int b) {
  int r = 1;
  while (b) {
    if (b & 1) {
      r = mul(r, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return r;
}

int dv(int a, int b) {
  return mul(a, pw(b, M - 2));
}

const int N = (int) 2e5 + 7;
int n;
int ans;
ll a[N], b[N];
pair<ll, ll> p[N], ip[N];

void painfulReading() {
  cin >> n;
  int yacklen = 0;
  for (int i = 1; i <= n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      ans = add(ans, 1);
      continue;
    }
    if (x == 0) {
      y = 1;
      yacklen++;
      a[yacklen] = 0;
      b[yacklen] = 1;
      continue;
    }
    if (y == 0) {
      x = 1;
      yacklen++;
      a[yacklen] = 1;
      b[yacklen] = 0;
      continue;
    }
    ll g = __gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if (x < 0 && y < 0) {
      x *= -1;
      y *= -1;
    }
    if (x < 0 && y > 0) {
      x *= -1;
      y *= -1;
    }
    yacklen++;
    a[yacklen] = x;
    b[yacklen] = y;
  }
  n = yacklen;
  for (int i = 1; i <= n; i++) {
    p[i] = {a[i], b[i]};
    if (b[i] > 0) {
      ip[i] = {b[i], -a[i]};
    } else {
      ip[i] = {-b[i], a[i]};
    }
  }
  ans = add(ans, -1);
  return;
  for (int i = 1; i <= n; i++) {
    cout << " : " << p[i].first << " " << p[i].second << ", " << ip[i].first << " " << ip[i].second << "\n";
  }
}

bool okMask(int mask) {
  vector<int> active;
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i)) {
      active.push_back(i + 1);
    }
  }
  for (auto &i : active) {
    for (auto &j : active) {
      if (p[i] == ip[j]) {
        return 0;
      }
    }
  }
  return 1;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); /// freopen ("input", "r", stdin);
  painfulReading();
  if (n > 20) {
    cout << "sorry darling\n";
    return 0;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    if (okMask(mask)) {
      ans = add(ans, 1);
    }
  }
  cout << ans << "\n";
  return 0;
}
