#include <stdio.h>
#include <stdlib.h>

#define HASH 100003
#define Mod 1000000007

typedef struct List {
	struct List *next;
	long long a, b;
	int num;
} list;

long long gcd(long long a, long long b)
{
	if (a > b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	if (b % a == 0) return a;
	else return gcd(b % a, a);
}

int main()
{
	int h, i, N;
	long long A, B, G;
	list *p, *hash[HASH] = {}, d[200010];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld %lld", &A, &B);
		if (A != 0 && B != 0) {
			G = gcd(llabs(A), llabs(B));
			A /= G;
			B /= G;
			if (A < 0) {
				A *= -1;
				B *= -1;
			}
		} else if (A != 0) A = 1;
		else if (B != 0) B = -1;
		
		h = (A % HASH - B % HASH * 397 + HASH * 397) % HASH;
		for (p = hash[h]; p != NULL; p = p->next) if (p->a == A && p->b == B) break;
		if (p != NULL) p->num++;
		else {
			d[i].a = A;
			d[i].b = B;
			d[i].num = 1;
			d[i].next = hash[h];
			hash[h] = &(d[i]);
		}
	}
	
	long long ans = 1, zero = 0, pow[200010], tmp;
	list *q, *r;
	for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i-1] * 2 % Mod;
	for (h = 0; h < HASH; h++) {
		for (p = hash[h]; p != NULL; p = p->next) {
			if (p->num > 0) {
				if (p->a == 0 && p->b == 0) zero += p->num;
				else {
					tmp = (p->b < 0)? p->a: -(p->a);
					i = (llabs(p->b) % HASH - tmp % HASH * 397 + HASH * 397) % HASH;
					for (q = hash[i]; q != NULL; q = q->next) if (q->a == llabs(p->b) && q->b == tmp) break;
					if (q == NULL) ans = ans * pow[p->num] % Mod;
					else {
						ans = ans * (pow[p->num] + pow[q->num] - 1) % Mod;
						q->num = 0;
					}
				}
			}
		}
	}
	printf("%lld\n", (ans + zero + Mod - 1) % Mod);
	fflush(stdout);
	return 0;
}