#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

#define P 1000000007

int comp(const void *a, const void *b){
	if(*(long*)a==*(long*)b){
		return (*((long*)a+1)>*((long*)b+1))-(*((long*)a+1)<*((long*)b+1));
	}else{
		return (*((long*)a+0)>*((long*)b+0))-(*((long*)a+0)<*((long*)b+0));
	}
}

long gcd2(long a, long b){
	long t;
	if(a>b) t=a, a=b, b=t;
	t = b % a;
	while(t!=0){
		b = a;
		a = t;
		t = b % a;
	}
	return a;
}

int icomp(const long *a, const long *b){
	if(a[0]==b[0]){
		return (a[1]>b[1])-(a[1]<b[1]);
	}else{
		return (a[0]>b[0])-(a[0]<b[0]);
	}
}

int m[200001];

long a[200000][2], b[200000][2];
int A, B;
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		long x=nextlong();
		long y=nextlong();
		bool f=false;
		if(x<0){x=-x; f=!f;}
		if(y<0){y=-y; f=!f;}
		long g = gcd2(x, y);
		if(f){
			a[A][0]=x/g;
			a[A][1]=y/g;
			A++;
		}else{
			b[B][0]=y/g;
			b[B][1]=x/g;
			B++;
		}
	}
	qsort(a, A, sizeof(long)*2, comp);
	qsort(b, B, sizeof(long)*2, comp);
	m[0]=1;
	for(int i=0; i<n; i++){
		m[i+1]=m[i]*2%P;
	}
	long ans=1;
	int x=0, y=0;
	int k=0;
	while(x<A&&y<B){
		int cp = icomp(a[x], b[y]);
		if(cp<0){
			x++; k++;
			ans=ans*2%P;
		}else if(cp>0){
			y++; k++;
			ans=ans*2%P;
		}else{
			int c=1, d=1;
			x++; y++; k+=2;
			while(x<A&&a[x][0]==a[x-1][0]&&a[x][1]==a[x-1][1]){ x++; k++; c++;}
			while(y<B&&b[y][0]==b[y-1][0]&&b[y][1]==b[y-1][1]){ y++; k++; d++;}
			ans=ans*(m[c]+m[d]-1)%P;
		}
	}
	ans=ans*m[n-k]%P;
	printf("%ld\n", ans-1);
}
