Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating changes by some value, possibly negative or zero.

Limak competed in n contests in the year 2016. He remembers that in the i-th contest he competed in the division di (i.e. he belonged to this division just before the start of this contest) and his rating changed by ci just after the contest. Note that negative ci denotes the loss of rating.

What is the maximum possible rating Limak can have right now, after all n contests? If his rating may be arbitrarily big, print "Infinity". If there is no scenario matching the given information, print "Impossible".

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 200 000).

The i-th of next n lines contains two integers ci and di ( - 100 ≤ ci ≤ 100, 1 ≤ di ≤ 2), describing Limak's rating change after the i-th contest and his division during the i-th contest contest.

Output

If Limak's current rating can be arbitrarily big, print "Infinity" (without quotes). If the situation is impossible, print "Impossible" (without quotes). Otherwise print one integer, denoting the maximum possible value of Limak's current rating, i.e. rating after the n contests.

Examples

Input

3
-7 1
5 2
8 2


Output

1907


Input

2
57 1
22 2


Output

Impossible


Input

1
-5 1


Output

Infinity


Input

4
27 2
13 1
-50 1
8 2


Output

1897

Note

In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating:

  * Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. 
  * With rating 1894 Limak is in the division 2. His rating increases by 5. 
  * Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets  + 8 and ends the year with rating 1907. 



In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest.
import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger; 
//import javafx.util.*; 
public final class B
{    
	static StringBuilder ans=new StringBuilder();
	static FastReader in=new FastReader();
	static ArrayList<ArrayList<Integer>> g;
	static long mod=(long)(1e9+7);
	static int D1[],D2[],par[];
	static boolean set[];
	static int value[];
	static long INF=Long.MAX_VALUE;
	static long dp[];
	static int N,M;
	static int A[][],B[][];
	static int s=1;
	public static void main(String args[])throws IOException
	{  					
		int N=i();
		int A[]=new int[N];
		int B[]=new int[N];
		int s=0,max=Integer.MIN_VALUE;
		int tot=0,max_tot=Integer.MIN_VALUE;
		boolean one=false,two=false;
		for(int i=0; i<N; i++)
		{
			A[i]=i();
			tot+=A[i];
			max_tot=Math.max(tot, max_tot);
			B[i]=i();
			if(B[i]==1)one=true;
			else two=true;
		}
		if(one && two)
		{
			for(int i=0; i<N-1; i++)
			{
				s+=A[i];
				max=Math.max(Math.abs(s), max);
				if(B[i]!=B[i+1])
				{
					int l=1899-Math.abs(max),r=1900+Math.abs(max);
					//System.out.println(l+" "+r);
					while(r-l>1)
					{
						int m=(l+r)/2;
						int f=f(m,A,B);
						if(f<=0)
						{
							l=m;
						}
						else 
						{
							r=m;
						}
					
					}
					if(f(l,A,B)==0)System.out.println(l+tot);
					else
					System.out.println("Impossible");
					return;			
				}

			}
		}

		if(one)System.out.println("Infinity");
		else
		{
			int l=1899-Math.abs(max_tot),r=1900+Math.abs(max_tot);
			while(r-l>1)
			{
				int m=(l+r)/2;
				int f=f(m,A,B);
				if(f<=0)
				{
					l=m;
				}
				else 
				{
					r=m;
				}
			
			}
			System.out.println(l+tot);
			
		}

	}	
	static int f(int rating,int A[],int B[])
	{
		int N=A.length;
		//System.out.print("FOR--> "+rating);
		for(int i=0; i<N; i++)
		{
			if(B[i]==1 && rating<1900)
			{
				return -1; //this means sum is less and move right
			}
			if(B[i]==2 && rating >= 1900)
			{
				return 1; //this means sum is greater and move left
			}
			rating+=A[i];
			//System.out.println(" "+rating);


		}
		return 0;
	}
	static void f(char X[],int l,int r,int N)
	{
		//if(l==r)return;
		// System.out.println("l--> "+l+" r--> "+r);
		int left=l,right=r;
		int m=(l+r)/2;
		boolean f=true; int j=m+1;
		while(l<=m && j<=r)
		{
			if(X[l]!=X[j])
			{
				if(X[j]>X[l])
				{
					f=false;					
				}
				break;
			}
			l++;
			j++;
		}
		l=left;
		r=right;
		if(!f)
		{
			int a=m-l;
			a++;
			int b=r-m;
			//System.out.println(a+" "+b);

			if(a<=b)

				m++;
		}
		while(m+1<N && X[m+1]=='0')m++;
		if(l==left && m==right)return;
		f(X,l,m,N);
		m++;
		while(m<=r)
		{
			if(X[m]!='0')s++;
			m++;
		}
		//System.out.println("EXIT--> "+s);

	}

	static int ask(int t,int i,int j,int x)
	{
		System.out.println("? "+t+" "+i+" "+j+" "+x);
		return i();
	}
	static int lower(ArrayList<Integer> A,int x)
	{
		int l=-1,r=A.size();
		while(r-l>1)
		{
			int m=(l+r)/2;
			if(A.get(m)<=x)l=m;
			else r=m;
		}
		return l;
	}
	static int ask(int a)
	{
		System.out.println("? 1 "+a);
		return i();
	}
	static int f(int st,int end,int d)
	{
		if(st>end)return 0;
		int a=0,b=0,c=0;
		if(d>1)a=f(st+d-1,end,d-1);
		b=f(st+d,end,d);
		c=f(st+d+1,end,d+1);
		return value[st]+max(a,b,c);
	}
	static int max(int a,int b,int c)
	{
		return Math.max(a, Math.max(c, b));
	}
	static int value(char X[],char Y[])
	{
		int c=0;
		for(int i=0; i<7; i++)
		{
			if(Y[i]=='1' && X[i]=='0')return -1;
			if(X[i]=='1' && Y[i]=='0')c++;
		}
		return c;
	}
	static boolean isValid(int i,int j)
	{
		if(i<0 || i>=N)return false;
		if(j<0 || j>=M)return false;
		return true;
	}

	static long fact(long N)
	{
		long num=1L;
		while(N>=1)
		{
			num=((num%mod)*(N%mod))%mod;
			N--;
		}
		return num;
	}
	static boolean reverse(long A[],int l,int r)
	{
		while(l<r)
		{
			long t=A[l];
			A[l]=A[r];
			A[r]=t;
			l++;
			r--;
		}
		if(isSorted(A))return true;
		else return false;
	}
	static boolean isSorted(long A[])
	{
		for(int i=1; i<A.length; i++)if(A[i]<A[i-1])return false;
		return true;
	}
	static boolean isPalindrome(char X[],int l,int r)
	{
		while(l<r)
		{
			if(X[l]!=X[r])return false;
			l++; r--;
		}
		return true;
	}

	static long min(long a,long b,long c)
	{
		return Math.min(a, Math.min(c, b));
	}

	static void print(int a)
	{
		System.out.println("! "+a);
	}
	static int ask(int a,int b)
	{
		System.out.println("? "+a+" "+b);
		return i();
	}
	static int find(int a)
	{
		if(par[a]<0)return a;
		return par[a]=find(par[a]);
	}
	static void union(int a,int b)
	{
		a=find(a);
		b=find(b);
		if(a!=b)
		{
			par[a]+=par[b]; //transfers the size
			par[b]=a;       //changes the parent
		}
	}
	static void swap(char A[],int a,int b)
	{
		char ch=A[a];
		A[a]=A[b];
		A[b]=ch;
	}

	static void sort(long[] a) //check for long
	{
		ArrayList<Long> l=new ArrayList<>();
		for (long i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	static void setGraph(int N)
	{
		g=new ArrayList<ArrayList<Integer>>();
		for(int i=0; i<=N; i++)
		{
			g.add(new ArrayList<Integer>());
		}
	}

	static  long pow(long a,long b)
	{
		long mod=1000000007;
		long pow=1;
		long x=a;
		while(b!=0)
		{
			if((b&1)!=0)pow=(pow*x)%mod;
			x=(x*x)%mod;
			b/=2;
		}
		return pow;
	}
	static long toggleBits(long x)//one's complement || Toggle bits
	{
		int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;

		return ((1<<n)-1)^x;
	}
	static int countBits(long a)
	{
		return (int)(Math.log(a)/Math.log(2)+1);
	}
	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	static boolean isPrime(long N)
	{
		if (N<=1)  return false; 
		if (N<=3)  return true; 
		if (N%2 == 0 || N%3 == 0) return false; 
		for (int i=5; i*i<=N; i=i+6) 
			if (N%i == 0 || N%(i+2) == 0) 
				return false; 
		return true; 
	}
	static long GCD(long a,long b) 
	{
		if(b==0)
		{
			return a;
		}
		else return GCD(b,a%b );
	}

	//Debugging Functions Starts

	static void print(char A[])
	{
		for(char c:A)System.out.print(c+" ");
		System.out.println();
	}
	static void print(boolean A[])
	{
		for(boolean c:A)System.out.print(c+" ");
		System.out.println();
	}
	static void print(int A[])
	{
		for(int a:A)System.out.print(a+" ");
		System.out.println();	
	}
	static void print(long A[])
	{
		for(long i:A)System.out.print(i+ " ");
		System.out.println();

	}
	static void print(ArrayList<Integer> A)
	{
		for(int a:A)System.out.print(a+" ");
		System.out.println();
	}

	//Debugging Functions END
	//----------------------
	//IO FUNCTIONS STARTS
	static HashMap<Integer,Integer> Hash(int A[])
	{
		HashMap<Integer,Integer> mp=new HashMap<>();
		for(int a:A)
		{
			int f=mp.getOrDefault(a,0)+1;
			mp.put(a, f);
		}
		return mp;
	}
	static int i()
	{
		return in.nextInt();
	}

	static long l()
	{
		return in.nextLong();
	}

	static int[] input(int N){
		int A[]=new int[N];
		for(int i=0; i<N; i++)
		{
			A[i]=in.nextInt();
		}
		return A;
	}

	static long[] inputLong(int N)     {
		long A[]=new long[N];
		for(int i=0; i<A.length; i++)A[i]=in.nextLong();
		return A;
	}

	//IO FUNCTIONS END

}

class node implements Comparable<node>
{
	long t;
	int index;
	node(long t,int index)
	{
		this.t=t;
		this.index=index;
	}
	public int compareTo(node X)
	{
		return this.index-X.index;
	}
}
//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
class FastReader
{
	BufferedReader br;
	StringTokenizer st;
	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	String next()
	{
		while(st==null || !st.hasMoreElements())
		{
			try
			{
				st=new StringTokenizer(br.readLine());
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt()
	{
		return Integer.parseInt(next());
	}

	long nextLong()
	{
		return Long.parseLong(next());
	}
	//gey
	double nextDouble()
	{
		return Double.parseDouble(next());
	}

	String nextLine()
	{
		String str="";
		try
		{
			str=br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}

}