#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 5;
const int MO = 1e9 + 7;
const int INV2 = 5e8 + 4;
inline int add(int x, int y) {
  x += y;
  if (x >= MO) x -= MO;
  return x;
}
inline int sub(int x, int y) {
  x -= y;
  if (x < 0) x += MO;
  return x;
}
inline int mul(int x, int y) { return 1LL * x * y % MO; }
inline void addv(int &x, int y) {
  x += y;
  if (x >= MO) x -= MO;
}
inline void subv(int &x, int y) {
  x -= y;
  if (x < 0) x += MO;
}
inline void mulv(int &x, int y) { x = 1LL * x * y % MO; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
struct Point {
  long long x, y;
  void read() {
    scanf("%lld%lld", &x, &y);
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if (y < 0)
      x = -x, y = -y;
    else if (y == 0 && x < 0)
      x = -x;
  }
} p[M];
map<pair<long long, long long>, int> cnt;
set<pair<long long, long long> > vis;
int er[M];
int main() {
  int n;
  scanf("%d", &n);
  int m = 0;
  int cnt0 = 0;
  for (int i = 0; i < n; i++, m++) {
    p[m].read();
    if (p[m].x == 0 && p[m].y == 0) cnt0++, m--;
    cnt[make_pair(p[m].x, p[m].y)]++;
  }
  er[0] = 1;
  for (int i = 1; i <= m; i++) er[i] = mul(er[i - 1], 2);
  int ans = 1;
  for (auto p : cnt) {
    pair<long long, long long> A = p.first;
    if (vis.count(A)) continue;
    pair<long long, long long> B;
    if (A.first < 0)
      B = make_pair(A.second, -A.first);
    else
      B = make_pair(-A.second, A.first);
    vis.insert(A);
    vis.insert(B);
    int c1 = p.second;
    int c2 = 0;
    if (cnt.count(B)) c2 += cnt[B];
    int nans = add(er[c1], er[c2]);
    subv(nans, 1);
    mulv(ans, nans);
  }
  addv(ans, cnt0);
  subv(ans, 1);
  printf("%d\n", ans);
  return 0;
}
