#include <bits/stdc++.h>
using namespace std;
typedef struct {
  long long a, b;
} pt;
bool operator<(pt p1, pt p2) {
  return (p1.a < p2.a) || (p1.a == p2.a && p1.b < p2.b);
}
bool operator>(pt p1, pt p2) {
  return (p1.a > p2.a) || (p1.a == p2.a && p1.b > p2.b);
}
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  if (a < b) {
    long long t = a;
    a = b;
    b = t;
  }
  if (a == b || b == 0)
    return a;
  else
    return gcd(b, a % b);
}
void solve() {
  int n;
  cin >> n;
  pt ab[200001];
  map<pair<long long, long long>, pair<int, int>> cnt;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    long long g = max(gcd(a, b), 1LL);
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    ab[i] = {a / g, b / g};
    if (b >= 0) {
      cnt[make_pair(a / g, b / g)].first++;
    } else {
      cnt[make_pair(-b / g, a / g)].second++;
    }
  }
  sort(ab, ab + n);
  long long ans = 1;
  for (auto c : cnt) {
    if (c.second.first == 0) {
      for (int i = 0; i < c.second.second; i++)
        ans = ((((ans) % 1000000007) * ((2) % 1000000007)) % 1000000007);
    } else if (c.second.second == 0) {
      for (int i = 0; i < c.second.first; i++)
        ans = ((((ans) % 1000000007) * ((2) % 1000000007)) % 1000000007);
    } else {
      long long val1 = 1, val2 = 1;
      for (int i = 0; i < c.second.first; i++)
        val1 = ((((val1) % 1000000007) * ((2) % 1000000007)) % 1000000007);
      for (int i = 0; i < c.second.second; i++)
        val2 = ((((val2) % 1000000007) * ((2) % 1000000007)) % 1000000007);
      val1 = (((val1) % 1000000007 + (val2) % 1000000007) % 1000000007);
      ans = ((((ans) % 1000000007) * (((val1 - 1)) % 1000000007)) % 1000000007);
    }
  }
  cout << ans - 1 << endl;
}
int main() {
  solve();
  return 0;
}
