#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main(int, char**) {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i] >> b[i];
    if (!a[i]) {
      if (b[i]) b[i] = 1;
    } else if (!b[i]) {
      a[i] = 1;
    } else {
      long long d = gcd(abs(a[i]), abs(b[i]));
      a[i] /= d;
      b[i] /= d;
    }
  }
  long long ans = 1;
  map<pair<long long, long long>, int> mp;
  for (int i = 0; i < (n); i++) {
    if (!a[i] && !b[i]) {
      mp[pair<long long, long long>(0, 0)]++;
      continue;
    }
    ans += (ans >> (mp[pair<long long, long long>(-b[i], a[i])] +
                    mp[pair<long long, long long>(b[i], -a[i])]));
    ans %= 1000000007;
    mp[pair<long long, long long>(a[i], b[i])]++;
  }
  ans += mp[pair<long long, long long>(0, 0)];
  ans--;
  cout << ans << endl;
  return 0;
}
