import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.Point;

// SHIVAM GUPTA :
//NSIT
//decoder_1671
//BEING PERFECTIONIST IS NOT AN OPTION.
// STOP NOT TILL IT IS DONE OR U DIE .
//EITHER MAKE IT OR BREAK IT.
//NEVER UNDERESTIMATE URSELF.
// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................
// REST ..HAVE FAITH ON DESTINY
//MIRACLE HAPPENS RARELY .....BUT IT HAPPENS ...

// ASCII = 48 + i ;

// 2^28 = 268,435,456  > 2* 10^8

// log 10 base 2 = 3.3219

// odd:: (x^2+1)/2 , (x^2-1)/2 ; x>=3

// even:: (x^2/4)+1 ,(x^2/4)-1  x >=4

// FOR ANY ODD NO N : N,N-1,N-2
//ALL ARE PAIRWISE COPRIME
//THEIR COMBINED LCM IS PRODUCT OF ALL THESE NOS

// two consecutive odds are always coprime to each other

// two consecutive even have always gcd  = 2 ;

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{

    // static int[] arr = new int[100002] ;
    // static int[] dp = new int[100002] ;

     static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		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());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

////////////////////////////////////////////////////////////////////////////////////
 public static int countDigit(long n)
    {
        return (int)Math.floor(Math.log10(n) + 1);
    }

/////////////////////////////////////////////////////////////////////////////////////////

 public static int sumOfDigits(long n)
 {

  if( n< 0)return -1 ;

  int sum = 0;

  while( n > 0)
  {
      sum = sum + (int)( n %10) ;

      n /= 10 ;
  }

  return sum ;

 }

 //////////////////////////////////////////////////////////////////////////////////////////////////

public static long arraySum(int[] arr , int start , int end)
{
    long ans = 0 ;

    for(int i = start ; i <= end  ; i++)ans += arr[i] ;

    return ans  ;
}

/////////////////////////////////////////////////////////////////////////////////

public static int mod(int x)
{
      if(x <0)return -1*x ;
      else return x ;
}
public static long mod(long x)
{
      if(x <0)return -1*x ;
      else return x ;
}

////////////////////////////////////////////////////////////////////////////////

public static void swapArray(int[] arr , int start , int end)
{
    while(start < end)
    {
        int temp = arr[start] ;
        arr[start] = arr[end];
        arr[end] = temp;
        start++ ;end-- ;
    }
}

//////////////////////////////////////////////////////////////////////////////////

public static int[][] rotate(int[][] input){

int n =input.length;
int m = input[0].length ;
int[][] output = new int [m][n];

for (int i=0; i<n; i++)
	for (int j=0;j<m; j++)
		output [j][n-1-i] = input[i][j];
return output;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////

public static int countBits(long n)
    {
        int count = 0;
        while (n != 0)
        {
            count++;
            n = (n) >> (1L) ;
        }

        return count;

    }
/////////////////////////////////////////// ////////////////////////////////////////////////

public static boolean isPowerOfTwo(long n)
{
    if(n==0)
    return false;

if(((n ) & (n-1)) == 0 ) return true ;
else return false  ;

}

/////////////////////////////////////////////////////////////////////////////////////

public static int  min(int a ,int b , int c, int d)
{
     int[] arr = new int[4] ;
      arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;

      return arr[0];
}
 /////////////////////////////////////////////////////////////////////////////
public static int  max(int a ,int b , int c, int d)
{
     int[] arr = new int[4] ;
      arr[0] = a;arr[1] = b ;arr[2] = c;arr[3] = d;Arrays.sort(arr) ;

      return arr[3];
}

///////////////////////////////////////////////////////////////////////////////////

public static String reverse(String input)
{
  StringBuilder str  = new StringBuilder("") ;

    for(int i =input.length()-1 ; i >= 0  ; i-- )
    {
        str.append(input.charAt(i));
    }

return str.toString() ;
}
///////////////////////////////////////////////////////////////////////////////////////////

public static boolean sameParity(long a  ,long b )
{
     long x = a% 2L; long y = b%2L ;
     if(x==y)return true  ;
     else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
public static boolean isPossibleTriangle(int a  ,int b , int c)
{
      if( a + b > c && c+b > a && a +c > b)return true  ;
      else return false  ;
}

////////////////////////////////////////////////////////////////////////////////////////////

public static int gcd(int a, int b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

public static long gcd(long a, long b )
{

if(b==0)return a ;

else return gcd(b,a%b) ;

}

////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c , int d )
{

int temp = lcm(a,b , c) ;

 int ans = lcm(temp ,d ) ;

return ans  ;

}

///////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a, int b ,int c )
{

int temp = lcm(a,b) ;

int ans =  lcm(temp ,c) ;

return ans  ;

}

////////////////////////////////////////////////////////////////////////////////////////

public static int lcm(int a , int b )
{

int gc = gcd(a,b);

return (a*b)/gc ;
}

///////////////////////////////////////////////////////////////////////////////////////////
static boolean isPrime(long n)
{
      if(n==1)
      {
            return false  ;
      }

      boolean ans =  true  ;

      for(long i = 2L; i*i <= n ;i++)
      {
            if(n% i ==0)
            {
                  ans = false  ;break ;
            }
      }

      return ans  ;
}
///////////////////////////////////////////////////////////////////////////

static int sieve =  1000000 ;

static boolean[] prime =  new boolean[sieve + 1] ;

public static void sieveOfEratosthenes()
    {
        // FALSE == prime

        // TRUE ==  COMPOSITE

        // FALSE== 1

        // time complexity = 0(NlogLogN)== o(N)

        // gives prime nos bw 1 to N

        for(int i = 4; i<= sieve ; i++)
        {
            prime[i] = true  ;
            i++ ;
        }

        for(int p = 3; p*p <= sieve; p++)
        {

            if(prime[p] == false)
            {

                for(int i = p*p; i <= sieve; i += p)
                    prime[i] = true;
            }

            p++ ;
        }

    }

///////////////////////////////////////////////////////////////////////////////////

public static void sortD(int[] arr , int s  , int e)
{
      sort(arr ,s , e) ;

      int i =s ; int j = e  ;

      while( i < j)
      {
            int temp = arr[i] ;
            arr[i] =arr[j] ;
            arr[j] = temp ;
            i++ ; j-- ;
      }

      return ;
}

/////////////////////////////////////////////////////////////////////////////////////////

public static long countSubarraysSumToK(long[] arr ,long sum )
    {
      HashMap<Long,Long> map = new HashMap<>() ;

      int n = arr.length ;

      long prefixsum = 0 ;

      long count = 0L ;
      for(int i  = 0; i < n ; i++)
      {
          prefixsum  = prefixsum +  arr[i] ;

          if(sum == prefixsum)count = count+1 ;

          if(map.containsKey(prefixsum -sum))
          {
              count = count + map.get(prefixsum -sum) ;
          }

          if(map.containsKey(prefixsum ))
          {
              map.put(prefixsum , map.get(prefixsum) +1 );
          }

          else{
              map.put(prefixsum , 1L );
          }

      }

      return count  ;

    }

///////////////////////////////////////////////////////////////////////////////////////////////

// KMP ALGORITHM : TIME COMPL:O(N+M)
// FINDS THE OCCURENCES OF PATTERN AS A  SUBSTRING IN STRING
//RETURN THE ARRAYLIST OF INDEXES
// IF SIZE OF LIST IS ZERO MEANS PATTERN IS NOT PRESENT IN STRING

public static ArrayList<Integer> kmpAlgorithm(String str , String pat)
     {
        ArrayList<Integer> list =new ArrayList<>();

        int n = str.length() ;
        int m = pat.length() ;

        String q = pat + "#" + str ;

        int[] lps  =new int[n+m+1] ;

         longestPefixSuffix(lps, q,(n+m+1)) ;

         for(int i =m+1 ; i < (n+m+1) ; i++ )
         {
             if(lps[i] == m)
             {
                 list.add(i-2*m) ;
             }
         }

        return list ;

    }

public static void longestPefixSuffix(int[] lps ,String str , int n)
    {
        lps[0] =  0 ;

        for(int i = 1  ; i<= n-1; i++)
        {
           int l = lps[i-1] ;

           while( l > 0 && str.charAt(i) != str.charAt(l))
           {
               l = lps[l-1] ;
           }

           if(str.charAt(i) == str.charAt(l))
           {
               l++ ;
           }

           lps[i] = l ;
        }

    }

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

 // CALCULATE TOTIENT Fn FOR ALL VALUES FROM 1 TO n
    // TOTIENT(N) = count of nos less than n and grater than 1 whose gcd with n is 1
    // or n and the no  will be coprime in nature
    //time : O(n*(log(logn)))

    public static void eulerTotientFunction(int[] arr ,int n )
    {

      for(int i = 1; i <= n  ;i++)arr[i] =i  ;

      for(int i= 2 ; i<= n ;i++)
      {
          if(arr[i] == i)
          {
              arr[i] =i-1 ;

              for(int j =2*i ; j<= n  ; j+= i )
              {
                  arr[j] = (arr[j]*(i-1))/i ;
              }

          }
      }

      return  ;

    }

/////////////////////////////////////////////////////////////////////////////////////////////
public static long nCr(int n,int k)
{
    long ans=1;
    k=k>n-k?n-k:k;
    int j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}

///////////////////////////////////////////////////////////////////////////////////////////

public static ArrayList<Integer> allFactors(int n)
{
      ArrayList<Integer> list = new ArrayList<>() ;

    for(int i = 1; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}

public static ArrayList<Long> allFactors(long n)
{
      ArrayList<Long> list = new ArrayList<>() ;

    for(long i = 1L; i*i <= n ;i++)
    {
          if( n % i == 0)
          {
              if(i*i == n)
              {
                    list.add(i) ;
              }
              else{
                    list.add(i) ;
                    list.add(n/i) ;

              }
          }
    }

     return list ;

}
////////////////////////////////////////////////////////////////////////////////////////////////////

  static final int MAXN = 10000001;

    static int spf[] = new int[MAXN];

    static void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)

            spf[i] = i;

        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAXN; i++)
        {

            if (spf[i] == i)
            {

                for (int j=i*i; j<MAXN; j+=i)

                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }

// The above code works well for n upto the order of 10^7.
// Beyond this we will face memory issues.

// Time Complexity: The precomputation for smallest prime factor is done in O(n log log n)
// using sieve.
// Where as in the calculation step we are dividing the number every time by
// the smallest prime number till it becomes 1.
// So, let’s consider a worst case in which every time the SPF is 2 .
// Therefore will have log n division steps.

// Hence, We can say that our Time Complexity will be O(log n) in worst case.

    static Vector<Integer> getFactorization(int x)
    {
        Vector<Integer> ret = new Vector<>();
        while (x != 1)
        {
            ret.add(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }

 //////////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////////

public static void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
  public static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

public static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

 /////////////////////////////////////////////////////////////////////////////////////////

	public static long knapsack(int[] weight,long value[],int maxWeight){

        int n=  value.length ;

	//dp[i] stores the profit with KnapSack capacity "i"
  long []dp = new long[maxWeight+1];

    //initially profit with 0 to W KnapSack capacity is 0
    Arrays.fill(dp, 0);

    // iterate through all items
    for(int i=0; i < n; i++)

        //traverse dp array from right to left
        for(int j = maxWeight; j >= weight[i]; j--)
            dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]);

    /*above line finds out maximum of dp[j](excluding ith element value)
    and val[i] + dp[j-wt[i]] (including ith element value and the
    profit with "KnapSack capacity - ith element weight") */
    return dp[maxWeight];
	}

///////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

// to return max sum of any subarray in given array
public static long kadanesAlgorithm(long[] arr)
{
      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}
/////////////////////////////////////////////////////////////////////////////////////////////
public static long kadanesAlgorithm(int[] arr)
{
      long[] dp = new long[arr.length] ;

      dp[0] = arr[0] ;
      long max =  dp[0] ;

      for(int i = 1; i <  arr.length ; i++)
      {
            if(dp[i-1] > 0)
            {
                  dp[i] = dp[i-1] + arr[i] ;
            }
            else{
                  dp[i] = arr[i] ;
            }

            if(dp[i] >  max)max = dp[i] ;

      }

      return max  ;

}

///////////////////////////////////////////////////////////////////////////////////////

// Arrays.sort(arr, new Comparator<Pair>() {
// 			@Override
// 			public int compare(Pair first, Pa second) {
// 				if (first.getAge() != second.getAge()) {
// 					return first.getAge() - second.getAge();
// 				}
// 				return first.getName().compareTo(second.getName());
// 			}
// 		});

/////////////////////////////////////////////////////////////////////////////////////////

public static long binarySerachGreater(int[] arr , int start , int end , int val)
{

      // fing total no of elements strictly grater than val in sorted array arr

      if(start >  end)return  0 ; //Base case

      int mid = (start + end)/2  ;

      if(arr[mid] <=val)
      {
          return binarySerachGreater(arr,mid+1, end ,val) ;

      }
      else{

         return binarySerachGreater(arr,start , mid -1,val) + end-mid+1 ;

      }

}

//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////

//TO GENERATE ALL(DUPLICATE ALSO EXIST) PERMUTATIONS OF A STRING

// JUST CALL generatePermutation( str,  start,  end) start :inclusive ,end : exclusive

//Function for swapping the characters at position I with character at position j
    public static String swapString(String a, int i, int j) {
        char[] b =a.toCharArray();
        char ch;
        ch = b[i];
        b[i] = b[j];
        b[j] = ch;
        return String.valueOf(b);
    }

//Function for generating different permutations of the string
    public static void generatePermutation(String str, int start, int end)
    {
        //Prints the permutations
        if (start == end-1)
            System.out.println(str);
        else
        {
            for (int i = start; i < end; i++)
            {
                //Swapping the string by fixing a character
                str = swapString(str,start,i);
                //Recursively calling function generatePermutation() for rest of the characters
                generatePermutation(str,start+1,end);
                //Backtracking and swapping the characters again.
                str = swapString(str,start,i);
            }
        }
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

public static long factMod(long n, long mod) {
    if (n <= 1) return 1;
    long ans = 1;
    for (int i = 1; i <= n; i++) {
      ans = (ans * i) % mod;
    }
    return ans;
  }

/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

public static long power(int x  ,int n)
    {
        //time comp : o(logn)

        if(n==0)return 1 ;
        if(n==1)return x;

        long ans =1L  ;

      while(n>0)
      {
          if(n % 2 ==1)
          {
              ans = ans *x ;
          }

          n /= 2 ;

          x =  x*x ;

      }

      return ans ;
    }

////////////////////////////////////////////////////////////////////////////////////////////////////
public static long powerMod(long x, long n, long mod) {
    //time comp : o(logn)

    if(n==0)return 1L ;
        if(n==1)return x;

    long ans = 1;
    while (n > 0) {
      if (n % 2 == 1) ans = (ans * x) % mod;
      x = (x * x) % mod;
      n /= 2;
    }
    return ans;
  }

//////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////

/*
lowerBound - finds largest element equal or less than value paased
upperBound - finds smallest element equal or more than value passed

if not present return -1;

*/

public static long lowerBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static int lowerBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]<=k)
			{
				ans=arr[mid];
				start=mid+1;
			}
			else
			{
				end=mid-1;
			}

		}

		return ans;

	}

	public static long upperBound(long[] arr,long k)
	{
		long ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

	public static int upperBound(int[] arr,int k)
	{
		int ans=-1;

		int start=0;
		int end=arr.length-1;

		while(start<=end)
		{
			int mid=(start+end)/2;

			if(arr[mid]>=k)
			{
				ans=arr[mid];
				end=mid-1;
			}
			else
			{
				start=mid+1;
			}

		}

		return ans;
	}

//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

static ArrayList<Integer>[] tree ;
static long[] child;
static int mod= 1000000007 ;

//program to calculate noof nodes in subtree for every vertex including itself

// static void dfs(int sv)
// {
//     child[sv] = 1L;

//     for(Integer x : tree[sv])
//     {
//         if(child[x] == 0)
//         {

//           dfs(x) ;

//           child[sv] += child[x] ;
//         }
//     }
// }

/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////

public static void solve()
{
FastReader scn = new FastReader() ;

//int[] store = {2 ,3, 5 , 7  ,11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 } ;

// product of first 11 prime nos is gre ater than 10 ^ 12;

ArrayList<Integer> list = new ArrayList<>() ;
ArrayList<Long> listl = new ArrayList<>() ;
//ArrayList<Integer> lista = new ArrayList<>() ;
//ArrayList<Integer> listb = new ArrayList<>() ;
//ArrayList<String> lists = new ArrayList<>() ;

HashMap<Integer,Integer> map = new HashMap<>() ;
//HashMap<Long,Long> map = new HashMap<>() ;
HashMap<Integer,Integer> map1  = new HashMap<>() ;
HashMap<Integer,Integer> map2  = new HashMap<>() ;
//HashMap<String,Integer> maps = new HashMap<>() ;
//HashMap<Integer,Boolean> mapb = new HashMap<>() ;
//HashMap<Point,Integer> point = new HashMap<>() ;

 Set<Integer> set = new HashSet<>() ;
 Set<Integer> setx = new HashSet<>() ;
 Set<Integer> sety = new HashSet<>() ;

StringBuilder sb =new StringBuilder("") ;

//Collections.sort(list);

//if(map.containsKey(arr[i]))map.put(arr[i] , map.get(arr[i]) +1 ) ;
//else map.put(arr[i],1) ;

// if(map.containsKey(temp))map.put(temp , map.get(temp) +1 ) ;
// else map.put(temp,1) ;

//int bit  =Integer.bitCount(n);
// gives total no of set bits in n;

int t = 1;

 t = scn.nextInt() ;

while(t-- > 0)
{

// tree = new ArrayList[n] ;

// child  = new long[n] ;

// for(int i = 0; i< n; i++)
// {
//     tree[i] = new ArrayList<Integer>();
// }

  int a = scn.nextInt() ;int b = scn.nextInt() ;int c = scn.nextInt() ;

if((a+b+c) % 2  != 0)
{
    out.println("Impossible");
}

 else{

     int x  = (a+b+c)/2 -c ;
     int y  = (a+b+c)/2 -a ;
     int z  = (a+b+c)/2 -b ;

     int pos = 0 ;

     if(x > 0)pos++ ;

      if(y > 0)pos++ ;

      if(z > 0)pos++ ;

     if(pos >= 2 && (x >= 0 && y >= 0 && z>= 0))
     {
        out.println(x+" " + y +" " +z) ;
     }

     else{
         out.println("Impossible") ;
     }

 }

//out.println(ans) ;

//out.println() ;

//for(int i = 0; i < n; i++)out.print(arr[i]+ " ") ;

// for(int i = 0; i < arr.length ; i++)
//  {
//      for(int j = 0; j < arr[0].length ; j ++)
//      {
//          out.print(arr[i][j] +" ");
//      }
//      out.println() ;
//   }

sb.delete(0 , sb.length()) ;
list.clear() ;
map.clear() ;
map1.clear() ;
map2.clear() ;
set.clear() ;

} // test case  end loop

out.flush() ;
} // solve fn ends

public static void main (String[] args) throws java.lang.Exception
{

solve() ;

}

}

 class Pair
{
  int first ;

  int second  ;

@Override
	public String toString() {

	String ans = "" ;
	ans  += this.first ;
	ans += " ";
	ans += this.second ;

	return ans  ;
	}

}


import java.util.Scanner;

/**
 *
 * @author Solo
 */
public class Burleys {
   private static int get9numb(long f){
       int num=0;
       while(f%10==0){
               num++;
               f/=10;
           }
       //System.out.println(num);
       return num;
       }

    public static void main(String[] args) {
        long startPrice,maxDev,finalVal,max9=0,tec9;
        Scanner sc = new Scanner(System.in);
        startPrice=sc.nextLong();
        maxDev=sc.nextLong();
        int a=1;
        finalVal=startPrice;
        for(long i=(startPrice-maxDev);i<startPrice;i=i+a){
            tec9=get9numb(i+1);
            if(tec9!=0){
                a=10;
                if(tec9>=max9){
                    max9=tec9;
                    finalVal=i;
                    }
                }
            }
        System.out.println(finalVal);
    }
}


import java.io.*;
import java.util.StringTokenizer;

public class SpecialOfferSuperPrice999Bourles {

    public static void main(String[] args) throws Exception  {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer(br.readLine());
        long num = Long.parseLong(st.nextToken());
        long des = Long.parseLong(st.nextToken());

        long max9 = 0;
        long result = 0;
        for (long i = num; i >= num-des; i--) {
            long count = 0;
            long n = i;
            while(n%10==9){
                count++;
                n/=10;
            }
            if(max9 < count){
                max9 = count;
                result = i;
            }
        }
        if(result!=0)
            while(result%10==0)
                result/=10;
        System.out.println(result==0?num:result);
    }
}


import java.io.*;
import java.lang.Math;
import java.util.*;

public class Main
{
	public BufferedReader in;
	public PrintStream out;

	public boolean log_enabled = false;

	int n;
	int[] adj_count;
	int[][] adj_list;

	long[] X, Y, Z;
	boolean[] V;

	long M = 998244353;

	public long modInverse(long a, long n) {
	 long i = n, v = 0, d = 1;
	 while (a>0) {
	  long t = i/a, x = a;
	  a = i % x;
	  i = x;
	  x = d;
	  d = v - t*x;
	  v = x;
	 }
	 v %= n;
	 if (v<0) v = (v+n)%n;
	 return v;
	}

	public void test()
	{
		n = readInt();
		int[] pars = readIntArray(2*n-2);

		int i,j;

		adj_count = new int[n];
		adj_list = new int[n][];

		Arrays.fill(adj_count, 0);
		for (i=0; i<n-1; i++)
		{
			adj_count[pars[2*i]-1] ++;
			adj_count[pars[2*i + 1]-1] ++;
		}

		for (i=0; i<n; i++)
		{
			adj_list[i] = new int[adj_count[i]];
			adj_count[i] = 0;
		}

		for (i=0; i<n-1; i++)
		{
			int a = pars[2*i]-1;
			int b = pars[2*i+1]-1;

			adj_list[a][adj_count[a] ++] = b;
			adj_list[b][adj_count[b] ++] = a;
		}

		X = new long[n];
		Y = new long[n];
		Z = new long[n];

		V = new boolean[n];
		Arrays.fill(V, false);

		dfs(0);

		out.println(Z[0]);
	}

	public void dfs(int p)
	{
		V[p] = true;

		int[] childs = new int[adj_count[p]];
		int i, ch_count = 0;
		for (i=0; i<adj_count[p]; i++)
		{
			if (!V[adj_list[p][i]])
			{
				childs[ ch_count ++] = adj_list[p][i];
				dfs(adj_list[p][i]);
			}
		}

		long pz = 1;
		long pxz = 1;

		for (i=0; i<ch_count; i++)
		{
			pz = (pz * Z[childs[i]]) % M;
			pxz = (pxz * (X[childs[i]] + Z[childs[i]])) % M;
		}

		Y[p] = pxz;
		X[p] = 0;
		for (i=0; i<ch_count; i++)
		{
			X[p] = (  X[p] + ( Y[childs[i]] * modInverse( Z[childs[i]] + X[childs[i]] % M , M) ) % M  ) % M;
		}
		X[p] = (X[p] * pxz) % M;
		Z[p] = (X[p] + pz) % M;

		logWrite("%d:\tX=%d\tY=%d\tZ=%d\n", p,X[p],Y[p],Z[p]);
	}

	public void run()
	{
		try
		{
			in = new BufferedReader(new InputStreamReader(System.in));
			out = System.out;

			//in = new BufferedReader(new FileReader("in.txt"));
			//out = new PrintStream(new File("out.txt"));

		}
		catch (Exception e)
		{
			return;
		}

		//while (true)
		{
			//int t = readInt(); for (int i=0; i<t; i++)
			{
				test();
			}
		}
	}

	public static void main(String args[])
	{
		new Main().run();
	}

	private StringTokenizer tokenizer = null;

	public int readInt()
	{
        return Integer.parseInt(readToken());
    }

    public long readLong()
	{
        return Long.parseLong(readToken());
    }

    public double readDouble()
	{
        return Double.parseDouble(readToken());
    }

	public String readLn()
	{
		try
		{
			String s;
			while ((s = in.readLine()).length()==0);
			return s;
		}
		catch (Exception e)
		{
			return "";
		}
	}

    public String readToken()
	{
		try
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				tokenizer = new StringTokenizer(in.readLine());
			}
			return tokenizer.nextToken();
		}
		catch (Exception e)
		{
			return "";
		}
    }

	public int[] readIntArray(int n)
	{
		int[] x = new int[n];
		readIntArray(x, n);
		return x;
	}

	public void readIntArray(int[] x, int n)
	{
		for (int i=0; i<n; i++)
		{
			x[i] = readInt();
		}
	}

	public void logWrite(String format, Object... args)
	{
		if (!log_enabled)
		{
			return;
		}

		out.printf(format, args);
	}
}


import javax.management.DynamicMBean;
import javax.print.DocFlavor;
import javax.print.attribute.HashAttributeSet;
import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.Inet4Address;
import java.nio.file.attribute.FileAttribute;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.util.Arrays;
import java.util.concurrent.Callable;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.TemporalAdjusters;

public class Main {

    static 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());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

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

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int n = sc.nextInt();
       String s=sc.next();
       int count=0;
       for(char c='z';c>'a';c--){
           for(int i=0;i<s.length();i++){
               if(s.charAt(i)==c){
                   if(i==0){
                       if( (int)s.charAt(i+1)==c-1){
                           s=s.substring(i+1);
                           count++;
                           i--;
                       }
                   }
                   else if(i==s.length()-1){
                       if((int)s.charAt(i-1)==c-1 ){
                           s=s.substring(0,i);
                           count++;
                           i--;
                       }
                   }
                   else if((int)s.charAt(i-1)==c-1 || (int)s.charAt(i+1)==c-1){
                       s=s.substring(0,i)+s.substring(i+1);
                       count++;
                       i--;
                   }

               }
           }
       }
        System.out.println(count);

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Stack;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Amine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInput in = new FastInput(inputStream);
        FastOutput out = new FastOutput(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.nextInt();
            Stack<Integer> s = new Stack<Integer>();
            int cur = 1;// what should be poped
            int err = 0;
            int res = 0;
            int max = 0;
            for (int i = 0; i < 2 * n; i++) {
                String c = in.nextString();
                if (c.startsWith("add")) {
                    if (err == 1) {
                        err = 0;
                        res++;
                        s.clear();
                        cur = max + 1;
                    }
                    int q = in.nextInt();
                    s.push(q);
                } else {
                    int t = s.peek();
                    if (t == cur && err == 0) {
                        s.pop();
                        cur++;
                    } else if (err == 1) {
                        err = 1;
                    } else {
                        err = 1;
                        if (t > max) {
                            max = t;
                        }
                    }
                }
            }
            if (err == 1)
                res++;
            out.println(res);
        }

    }

    static class FastInput {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastInput.SpaceCharFilter filter;

        public FastInput(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class FastOutput {
        private final PrintWriter writer;

        public FastOutput(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public FastOutput(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}


import java.util.Scanner;

public class AA {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc= new Scanner(System.in);
		int a = sc.nextInt();
		int b= sc.nextInt();
		int c= sc.nextInt();
		System.out.println(2*(a+b+c));
	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        //     PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int result = 0;
        while(a > 0 && b > 0 && c > 0){
            result += 2*(a + b + c);
            result -=6;
            a--;
            b--;
            c--;
        }
        out.println(result);
        out.close();
    }

    static class Dragon implements Comparable<Dragon> {

        int x, y;

        public Dragon(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Dragon o) {
            if (x != o.x) {
                return x - o.x;
            } else {
                return o.y - y;
            }
        }
    }

    static double dist(Point a, Point b) {
        long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
        return Math.sqrt(total);
    }

    static class Point {

        int x, y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;

        }
    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static int pow(int a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        int val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val;
        } else {
            return val * val * a;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
//    static Point minus(Point a, Point b) {
//        return new Point(a.x - b.x, a.y - b.y);
//    }
//
//    static Point add(Point a, Point b) {
//        return new Point(a.x + b.x, a.y + b.y);
//    }
//
//    static double cross(Point a, Point b) {
//        return a.x * b.y - a.y * b.x;
//
//
//    }
//
//    static class Point {
//
//        int x, y;
//
//        Point(int x, int y) {
//            this.x = x;
//            this.y = y;
//        }
//
//        @Override
//        public String toString() {
//            return "Point: " + x + " " + y;
//        }
//    }
    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new FileReader(new File("input.txt")));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author toshif
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyReader in = new MyReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        private int n;
        private int c1;
        private int c2;

        public void solve(int testNumber, MyReader in, PrintWriter out) {
            n = in.nextInt();
            c1 = in.nextInt();
            c2 = in.nextInt();

            String s = in.next();
            int parent = 0;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == '1') {
                    parent++;
                }
            }

            // ternary search
            long lo = 1, hi = parent;
            while (hi - lo > 1) {
                long mid = (lo + hi) / 2;
                if (f(mid) > f(mid + 1)) {
                    hi = mid;
                } else {
                    lo = mid;
                }
            }
            if (f(lo) < f(hi)) {
                out.println(f(lo));
            } else {
                out.println(f(hi));
            }

        }

        long f(long v) {
            long p1 = n / v;

            long sum = c1 * v;
            sum += (n % v) * c2 * (p1) * (p1);
            sum += (v - (n % v)) * c2 * (p1 - 1) * (p1 - 1);

            return sum;
        }

    }

    static class MyReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public MyReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}


import static java.lang.System.out;
import java.util.Scanner;

// 795A
// n people, some pupil, some adult. separate into groups. a group must have 1 adult
// if a group has x people, cost of tickets=c1+c2(x-1)^2
// find minimal price
public class AmusementPark {

    int adult;
    int pupil;
    int n;      // 1 ≤ n ≤ 200 000
    long c1;    // 1 ≤ c1, c2 ≤ 10^7
    long c2;
    long minCost=0;

    long formula(int x)
    {
        return c1+c2*(x-1)*(x-1);
    }
    long calc(int group)
    {
        if (group==1)
        {
            return formula(n);
        }
        int avg = n/group;
        int rem = n%group;
        long cost = formula(avg);
        if ( rem>0 ) {
            cost *= (group-rem);
            return cost + rem*formula(avg+1);
        }
        else
            return cost *group;
    }
    long cost(int lo, int hi, long lowCost, long hiCost)
    {
        if (lo-hi<=1 && lo-hi>=-1) {
            return lowCost;
        }
        int mid = (lo+hi)/2;
        long midCost = calc(mid);
        //out.println("first "+lo+" second "+hi+ " mid cost "+midCost+" low clost "+lowCost+" hi cost "+hiCost);
        if (midCost<lowCost)
            return cost(mid, lo, midCost, lowCost);
        else if ( midCost < hiCost )
            return cost(lo, mid, lowCost, midCost);
        else {
            //out.println("bad mid cost "+midCost+" low clost "+lowCost+" hi cost "+hiCost);
            return midCost;
        }
    }
    AmusementPark(int a, int p, int c1, int c2)
    {
        adult = a;
        pupil = p;
        n = a+p;
        this.c1 = c1;
        this.c2 = c2;
        long cost1 = calc(1);
        long cost2 = calc(a);
        if (cost1>cost2)
            out.println(cost(a, 1, cost2, cost1));
        else if (cost1<cost2)
            out.println(cost(1, a, cost1, cost2));
        else
            out.println(cost1);
    }

    static Scanner scan = new Scanner(System.in);
    static void autoTest()
    {
        int n = scan.nextInt();  // between 1 and 20000
        int c1 = scan.nextInt();  // between 1 and 10^7
        int c2 = scan.nextInt();  // between 1 and 10^7
        String people = scan.nextLine();
        if (people.isEmpty())
            people = scan.nextLine();
        int pupil=0;
        int adult=0;
        for(int i=0; i<people.length(); i++)
        {
            if (people.charAt(i)=='1')
                adult++;
            else
                pupil++;
        }
        new AmusementPark(adult, pupil, c1, c2);
    }
    public static void main(String[] args)
    {
        autoTest();
    }
}
/*
10 2 2
1111101111
ans 20
*/


import java.util.Scanner;

public class cf774A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int c1=in.nextInt();
		int c2=in.nextInt();
		in.nextLine();
		String str=in.nextLine();

		int n0=0;
		int n1=0;

		for(int i=0;i<str.length();i++){
			if (str.charAt(i)=='0')
				n0++;
			else
				n1++;
		}

		long min=getv(n,1,c1,c2);

		for (int i=2;i<=n1;i++){
			long temp = getv(n,i,c1,c2);
			if (temp<min)
				min=temp;
		}

		System.out.println(min);

	}

	static long getv(int n,int k,int c1,int c2){
		long temp;
		int t1=n/k;
		int t2=n%k;
		temp=c1*k+t2*c2*(t1*t1) + (k-t2)*c2*(t1-1)*(t1-1);
		return temp;
	}

}


import java.util.*;
public class Main{
     public static void main(String ... ss){
          Scanner sc = new Scanner(System.in);
          int a = sc.nextInt();
          int b = sc.nextInt();
          int pairs = Math.abs(a-b) - 1;
          int ans = 0;
          while(true){
               ans++;
               a--;
               b--;
               if(a==0 || b==0) break;
          }
          pairs = Maths.max(a,b)/2;
          System.out.println(ans + " " + pairs);
     }
}


import java.util.Scanner;

public class love {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		min = a;
		if(min > b)
		    min = b;
		int total=a+b;
		int rem=total-min;
		System.out.println(min+" "+rem/2);
	}
}


public class VasyatheHipster{
public static int Diferentes(int a, int b)
        {
            if (a<=b)
                    return a;
            else
                return b;

        }
    public static int Iguales(int a, int b)
    {
        int Aux=a-b;
        return Aux/2;
    }
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner a=new Scanner(System.in);
        int b=a.nextInt();
        int c=a.nextInt();
        System.out.print(Diferentes(b, c));
        System.out.print(" "+Iguales(b, c));
    }
}


import java.util.*;

public class MainB {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int row = Integer.parseInt(line.substring(0, line.length() - 1));
		char column = line.charAt(line.length() - 1);

		int n = row / 4;
		int c = row % 4;

		int time = 0;

		if (c == 0) {
			time += (n - 1) * 16;
			c = 4;
		} else {
			time += n * 16;
		}

		if (c == 2 || c == 4) {
			time += 7;
		}

		if (column >= 'd' && column <= 'f') {
			time += 'f' - column + 1;
		} else {
			time += 3 + column - 'a' + 1;
		}

		System.out.println(time);
	}
}


import static java.util.Arrays.*;

import java.math.*;

public class E {

	public Object solve () {
		int N = sc.nextInt() - 1, S = sc.nextInt(), R = sc.nextInt();

		if (N == 0)
			return exit(1);
		if (R == 0)
			if (S == 0)
				return exit(modInv(N+1));
			else
				return 0;

		long [][] C = modBin(N, N);

		long P = 0;
		for (int b = S; b >= R; --b) {
			if (b * N < S - b)
				break;

			long [][] F = new long [N+1][S+1]; fill(F[0], 1);
			for (int k = 1; k <= N; ++k) {
				F[k][0] = 1;
				for (int x = 1; x <= S; ++x) {
					F[k][x] = (F[k][x-1] + F[k-1][x]) % MOD;
					if (x >= b)
						F[k][x] = (F[k][x] + MOD - F[k-1][x-b]) % MOD;
				}
			}

			for (int j = 0; j <= N; ++j) {
				int T = S - b * (j+1);
				if (T >= 0) {
					long D = F[N-j][T];
					if (T > 0)
						D = (D + MOD - F[N-j][T-1]) % MOD;
					long Z = (C[N][j] * D) % MOD;
					P = (P + Z * modInv(j+1)) % MOD;
				}
			}
		}

		long Q = 0;
		long [][] F = new long [N+1][S+1]; fill(F[0], 1);
		for (int k = 1; k <= N; ++k) {
			F[k][0] = 1;
			for (int x = 1; x <= S; ++x)
				F[k][x] = (F[k][x-1] + F[k-1][x]) % MOD;
		}
		Q = F[N][S-R];

		long res = (P * modInv(Q)) % MOD;
		return exit(res);
	}

	private static final boolean ONE_TEST_CASE = true;

	private static void init () {
	}

	private static final int MOD = 998244353;
	private static long mod (long x) { return mod(x, MOD); }
	private static long mod (long x, long mod) { return ((x % mod) + mod) % mod; }
	private static long [][] modBin (int N, int K) {
		long [][] res = new long [N+1][K+1];
		for (int n = 0; n <= N; ++n) {
			res[n][0] = 1;
			for (int k = 1; k <= K && k <= n; ++k)
				res[n][k] = mod(res[n-1][k] + res[n-1][k-1]);
		}
		return res;
	}
	private static long modInv(long x) { return modInv(x, MOD); }
	private static long modInv(long x, int mod) { return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue(); }
	//////////////////////////////////////////////////////////////////////////////////// OFF
	private static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; }
	private static Object exit (Object o, Object ... A) { print(o, A); IOUtils.exit(); return null; }
	private static class IOUtils {
		public static class MyScanner {
			public String next () { newLine(); return line[index++]; }
			public int nextInt () { return Integer.parseInt(next()); }
			//////////////////////////////////////////////
			private boolean eol () { return index == line.length; }
			private String readLine () {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] line;
			private int index;
			private void newLine () {
				if (line == null || eol()) {
					line = split(readLine());
					index = 0;
				}
			}
			private String [] split (String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build (Object o, Object ... A) { return buildDelim(" ", o, A); }
		private static String buildDelim (String delim, Object o, Object ... A) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : A)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static final java.text.DecimalFormat formatter = new java.text.DecimalFormat("#.#########");
		private static void start () { if (t == 0) t = millis(); }
		private static void append (java.util.function.Consumer<Object> f, java.util.function.Consumer<Object> g, final Object o) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					f.accept(java.lang.reflect.Array.get(o, i));
			}
			else if (o instanceof Iterable<?>)
				((Iterable<?>)o).forEach(f::accept);
			else
				g.accept(o instanceof Double ? formatter.format(o) : o);
		}
		private static void append (final StringBuilder b, Object o, final String delim) {
			append(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print (Object o, Object ... A) {
			pw.println(build(o, A));
			if (DEBUG)
				pw.flush();
		}
		private static void err (Object o, Object ... A) { System.err.println(build(o, A)); }
		private static boolean DEBUG;
		private static void write (Object o) {
			err(o, '(', time(), ')');
			if (!DEBUG)
				pw.println(o);
		}
		private static void exit () {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(time());
			System.exit(0);
		}
		private static long t;
		private static long millis () { return System.currentTimeMillis(); }
		private static String time () { return "Time: " + (millis() - t) / 1000.0; }
		private static void run (int N) {
			try { DEBUG = System.getProperties().containsKey("DEBUG"); }
			catch (Throwable t) {}

			for (int n = 1; n <= N; ++n) {
				Object res = new E().solve();
				if (res != null)
					write("Case #" + n + ": " + build(res));
			}
			exit();
		}
	}
	////////////////////////////////////////////////////////////////////////////////////
	public static void main (String[] args) {
		init();
		int N = ONE_TEST_CASE ? 1 : sc.nextInt();
		IOUtils.run(N);
	}
}


import java.math.*;
import java.util.*;

public class E {

	public Object solve () {
		int N = sc.nextInt() - 1, S = sc.nextInt(), R = sc.nextInt();

		if (N == 0)
			return exit(1);
		if (S == 0)
			return exit(modInv(N+1));

		C = modBin(N, N);
		long [] V = modInvs(N+1);

		long P = 0;
		for (int B = R; B <= S; ++B) {
			if (B * (N+1) < S)
				continue;
			for (int j = 0; j <= N; ++j) {
				int T = S - B * (j+1);
				if (T >= 0) {
					long D = F(B, N-j, T);
					if (T > 0)
						D = (D + MOD - F(B, N-j, T-1)) % MOD;
					long Z = (C[N][j] * D) % MOD;
					P = (P + Z * V[j+1]) % MOD;
				}
			}
		}

		long Q = F(S-R+1, N, S-R);

		long res = (P * modInv(Q)) % MOD;
		return exit(res);
	}

	long [][] C;

	int F(int B, int K, int X) {
		if (B == 0) return K == 0 ? 1 : 0;

		long Q = 6000L * (6000 * B + X) + K;
		Integer R = H.get(Q);
		if (R != null)
			return R;

		long res = 0;
		for (int j = 0; j <= K && j * (B-1) <= X; ++j)
			res = (res + C[K][j] * F(B-1, K-j, X - j * (B-1))) % MOD;
		H.put(Q, (int)res);
		return (int)res;
	}

	Map<Long, Integer> H = new HashMap<>();

	private static final boolean ONE_TEST_CASE = true;

	private static void init () {
	}

	private static final int MOD = 998244353;
	private static long mod (long x) { return mod(x, MOD); }
	private static long mod (long x, long mod) { return ((x % mod) + mod) % mod; }
	private static long [][] modBin (int N, int K) {
		long [][] res = new long [N+1][K+1];
		for (int n = 0; n <= N; ++n) {
			res[n][0] = 1;
			for (int k = 1; k <= K && k <= n; ++k)
				res[n][k] = mod(res[n-1][k] + res[n-1][k-1]);
		}
		return res;
	}
	private static long modInv(long x) { return modInv(x, MOD); }
	private static long modInv(long x, int mod) { return BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod)).longValue(); }
	private static long [] modInvs(int N) {
		long [] res = new long [N+1];
		for (int i = 1; i <= N; ++i)
			res[i] = modInv(i);
		return res;
	}
	//////////////////////////////////////////////////////////////////////////////////// OFF
	private static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; }
	private static Object exit (Object o, Object ... A) { print(o, A); IOUtils.exit(); return null; }
	private static class IOUtils {
		public static class MyScanner {
			public String next () { newLine(); return line[index++]; }
			public int nextInt () { return Integer.parseInt(next()); }
			//////////////////////////////////////////////
			private boolean eol () { return index == line.length; }
			private String readLine () {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] line;
			private int index;
			private void newLine () {
				if (line == null || eol()) {
					line = split(readLine());
					index = 0;
				}
			}
			private String [] split (String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build (Object o, Object ... A) { return buildDelim(" ", o, A); }
		private static String buildDelim (String delim, Object o, Object ... A) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : A)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static final java.text.DecimalFormat formatter = new java.text.DecimalFormat("#.#########");
		private static void start () { if (t == 0) t = millis(); }
		private static void append (java.util.function.Consumer<Object> f, java.util.function.Consumer<Object> g, final Object o) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					f.accept(java.lang.reflect.Array.get(o, i));
			}
			else if (o instanceof Iterable<?>)
				((Iterable<?>)o).forEach(f::accept);
			else
				g.accept(o instanceof Double ? formatter.format(o) : o);
		}
		private static void append (final StringBuilder b, Object o, final String delim) {
			append(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print (Object o, Object ... A) {
			pw.println(build(o, A));
			if (DEBUG)
				pw.flush();
		}
		private static void err (Object o, Object ... A) { System.err.println(build(o, A)); }
		private static boolean DEBUG;
		private static void write (Object o) {
			err(o, '(', time(), ')');
			if (!DEBUG)
				pw.println(o);
		}
		private static void exit () {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(time());
			System.exit(0);
		}
		private static long t;
		private static long millis () { return System.currentTimeMillis(); }
		private static String time () { return "Time: " + (millis() - t) / 1000.0; }
		private static void run (int N) {
			try { DEBUG = System.getProperties().containsKey("DEBUG"); }
			catch (Throwable t) {}

			for (int n = 1; n <= N; ++n) {
				Object res = new E().solve();
				if (res != null)
					write("Case #" + n + ": " + build(res));
			}
			exit();
		}
	}
	////////////////////////////////////////////////////////////////////////////////////
	public static void main (String[] args) {
		init();
		int N = ONE_TEST_CASE ? 1 : sc.nextInt();
		IOUtils.run(N);
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class E {
  public static int mod = 998244353;
  public static int[] fact;
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        int p = Integer.parseInt(st.nextToken());
        int s = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());

        long PIE = 0; // ways of someone >= r;
        int sign = 1;
        fact = new int[6001];
        fact[0] = 1;
        for(int i=1; i<=6000; i++) {
          fact[i] = (int)(1L*fact[i-1]*i % mod);
        }
        for(int i=1; i<=p; i++) {

          if(i < p) PIE += sign*(1L*choose(p, i)*choose(s - i*r + p-i-1, p-i-1) % mod);
          else PIE += sign*1;
          PIE += mod;
          PIE %= mod;

          sign = -1*sign;
        }

        long ways_first = choose(s-r+p-2, p-2) % mod;
        long ans = frac((int)PIE, (int)((1L * ways_first * p) % mod));
        out.println(ans);

        // int n = scan.nextInt();

        out.close(); System.exit(0);
    }
    public static int exp(int base, int e) {
      if(e == 0) return 1;
      if(e == 1) return base;
      int val = exp(base, e/2);
      int ans = (int)(1L*val*val % mod);
      if(e % 2 == 1)
        ans = (int)(1L*ans*base % mod);
      return ans;
    }
    public static int inv(int base) {
      return exp(base, mod-2);
    }
    public static long frac(int p, int q) {
      return (1L*p*inv(q) % mod);
    }
    public static long choose(int a, int b) {
      if(a<b) return 0;
      if(b < 0) return 0;
      return frac(fact[a],(int)(1L*fact[b]*fact[a-b] % mod));
    }
}


/**
 * @author derrick20
 */

import java.io.*;
import java.util.*;

public class TopScorer {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int P = sc.nextInt();
        int S = sc.nextInt();
        int R = sc.nextInt();
        // it should go up to s + p - 1, 5099, but let's be safe
        int MAX = (int) 1e5; // todo change this!
        fact = new long[MAX + 1];
        invFact = new long[MAX + 1];
        fact[0] = 1;
        invFact[0] = 1;
        for (int i = 1; i <= MAX; i++) {
            fact[i] = ((long) i * fact[i - 1]) % mod;
            invFact[i] = inv(fact[i]);
        }

        if (P == 1) {
            out.println(1);
        } else {
            // O(SP^2) = 5*10^7
            long wins = 0;
            long total = 0;
            for (int x = R; x <= S; x++) {
                // l = group that gets x
                // the remaining players P - 1 - l must get < x.
                for (int l = 0; P - 1 - l >= 0 && S - x - l * x >= 0; l++) {
                    int players = P - 1 - l;
                    int balls = S - x - l * x;
//                    System.out.println("Forced " + l + " other players to have exactly " + x + " balls");
//                    System.out.println("Remaining: players = " + players + " balls = " + balls);
                    long prob = (choose(P - 1, l) * f(players, balls, x)) % mod;
                    // prob of having this number of x's for players, then given
                    // that, the probability of winning is uniform among all x players
                    long contrib = (inv(l + 1) * prob) % mod;
                    wins = (wins + contrib) % mod;
//                    System.out.println("Prob: " + prob + " Contrib: " + contrib);
//                    System.out.println();
                }
                long ways = choose(S - x + P - 2, P - 2);
//                System.out.println("Ways for x = " + x + " = " + ways);
//                System.out.println("----------");
                total = (total + ways) % mod;
            }
            // we have now counted the number of winning states (scaling
            // with the f function). The probability is this divided by total
            // states.
            long prob = (wins * inv(total)) % mod;
            out.println(prob);
        }
        out.close();
    }

    // todo SET THE MOD
    static long mod = 998244353;
    static long[] fact, invFact;

    // f returns probability that with these parameters, we get an assignment
    // where all have < x balls.
    static long f(int players, int balls, int x) {
        // if there are no players, there MUST BE only 1 way.
        if (players == 0) {
            ASSERT(balls <= x, "Gave impossible amt");
            return (balls <= x) ? 1 : 0;
        }
        long total = choose(balls + players - 1, players - 1);
        long complement = 0;
        int sign = 1;
        for (int k = 1; k <= players && balls - k * x >= 0; k++) {
            long amt = (choose(players, k) * choose(balls - k * x + players - 1, players - 1)) % mod;
            complement = (complement + sign * amt) % mod;
            sign *= -1;
        }
//        System.out.println("Ways for (players, balls) = " + players + " " + balls + ": Total " + total + ", Complement: " + complement);
        long ans = (total - complement + mod) % mod;
//        ans = (ans * inv(total)) % mod; // probability
        return ans;
    }

    static long choose(int n, int k) {
        ASSERT(k <= n, "Invalid choose");
        long ans = (fact[n] * invFact[n - k]) % mod;
        return (ans * invFact[k]) % mod;
    }

    static long inv(long x) {
        return fastExpo(x, mod - 2);
    }

    static long fastExpo(long x, long k) {
        long ans = 1;
        long bit = x;
        while (k > 0) {
            if (k % 2 == 1) {
                ans = (bit * ans) % mod;
            }
            bit = (bit * bit) % mod;
            k /= 2;
        }
        return ans;
    }

    static class FastScanner {
        private int BS = 1 << 16;
        private char NC = (char) 0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            } catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar() {
            while (bId == size) {
                try {
                    size = in.read(buf);
                } catch (Exception e) {
                    return NC;
                }
                if (size == -1) return NC;
                bId = 0;
            }
            return (char) buf[bId++];
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt = 1;
            boolean neg = false;
            if (c == NC) c = getChar();
            for (; (c < '0' || c > '9'); c = getChar()) {
                if (c == '-') neg = true;
            }
            long res = 0;
            for (; c >= '0' && c <= '9'; c = getChar()) {
                res = (res << 3) + (res << 1) + c - '0';
                cnt *= 10;
            }
            return neg ? -res : res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c != '.' ? cur : cur + nextLong() / cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c > 32) {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c != '\n') {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if (c > 32) return true;
            while (true) {
                c = getChar();
                if (c == NC) return false;
                else if (c > 32) return true;
            }
        }
    }

    static void ASSERT(boolean assertion, String message) {
        if (!assertion) throw new AssertionError(message);
    }
}


/**
 * @author derrick20
 */

import java.io.*;
import java.util.*;

public class TopScorer {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int P = sc.nextInt();
        int S = sc.nextInt();
        int R = sc.nextInt();
        // it should go up to s + p - 1, 5099, but let's be safe
        int MAX = (int) 1e5; // todo change this!
        fact = new long[MAX + 1];
        invFact = new long[MAX + 1];
        fact[0] = 1;
        invFact[0] = 1;
        for (int i = 1; i <= MAX; i++) {
            fact[i] = ((long) i * fact[i - 1]) % mod;
            invFact[i] = inv(fact[i]);
        }

        if (P == 1) {
            out.println(1);
        } else {
            // O(SP^2) = 5*10^7
            long wins = 0;
            long total = 0;
            for (int x = R; x <= S; x++) {
                // l = group that gets x
                // the remaining players P - 1 - l must get < x.
                for (int l = 0; P - 1 - l >= 0 && S - x - l * x >= 0; l++) {
                    int players = P - 1 - l;
                    int balls = S - x - l * x;
//                    System.out.println("Forced " + l + " other players to have exactly " + x + " balls");
//                    System.out.println("Remaining: players = " + players + " balls = " + balls);
                    long prob = (choose(P - 1, l) * f(players, balls, x)) % mod;
                    // prob of having this number of x's for players, then given
                    // that, the probability of winning is uniform among all x players
                    long contrib = (inv(l + 1) * prob) % mod;
                    wins = (wins + contrib) % mod;
//                    System.out.println("Prob: " + prob + " Contrib: " + contrib);
//                    System.out.println();
                }
                long ways = choose(S - x + P - 2, P - 2);
//                System.out.println("Ways for x = " + x + " = " + ways);
//                System.out.println("----------");
                total = (total + ways) % mod;
            }
            // we have now counted the number of winning states (scaling
            // with the f function). The probability is this divided by total
            // states.
            long prob = (wins * inv(total)) % mod;
            out.println(prob);
        }
        out.close();
    }

    // todo SET THE MOD
    static long mod = 998244353;
    static long[] fact, invFact;

    // f returns probability that with these parameters, we get an assignment
    // where all have < x balls.
    static long f(int players, int balls, int x) {
        // if there are no players, there MUST BE only 1 way.
        if (players == 0) {
//            ASSERT(balls <= x, "Gave impossible amt");
            return (balls <= x) ? 1 : 0;
        }
        long total = choose(balls + players - 1, players - 1);
        long complement = 0;
        int sign = 1;
        for (int k = 1; k <= players && balls - k * x >= 0; k++) {
            long amt = (choose(players, k) * choose(balls - k * x + players - 1, players - 1)) % mod;
            complement = (complement + sign * amt) % mod;
            sign *= -1;
        }
//        System.out.println("Ways for (players, balls) = " + players + " " + balls + ": Total " + total + ", Complement: " + complement);
        long ans = (total - complement + mod) % mod;
//        ans = (ans * inv(total)) % mod; // probability
        return ans;
    }

    static long choose(int n, int k) {
        ASSERT(k <= n, "Invalid choose");
        long ans = (fact[n] * invFact[n - k]) % mod;
        return (ans * invFact[k]) % mod;
    }

    static long inv(long x) {
        return fastExpo(x, mod - 2);
    }

    static long fastExpo(long x, long k) {
        long ans = 1;
        long bit = x;
        while (k > 0) {
            if (k % 2 == 1) {
                ans = (bit * ans) % mod;
            }
            bit = (bit * bit) % mod;
            k /= 2;
        }
        return ans;
    }

    static class FastScanner {
        private int BS = 1 << 16;
        private char NC = (char) 0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            } catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar() {
            while (bId == size) {
                try {
                    size = in.read(buf);
                } catch (Exception e) {
                    return NC;
                }
                if (size == -1) return NC;
                bId = 0;
            }
            return (char) buf[bId++];
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt = 1;
            boolean neg = false;
            if (c == NC) c = getChar();
            for (; (c < '0' || c > '9'); c = getChar()) {
                if (c == '-') neg = true;
            }
            long res = 0;
            for (; c >= '0' && c <= '9'; c = getChar()) {
                res = (res << 3) + (res << 1) + c - '0';
                cnt *= 10;
            }
            return neg ? -res : res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c != '.' ? cur : cur + nextLong() / cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c > 32) {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c != '\n') {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if (c > 32) return true;
            while (true) {
                c = getChar();
                if (c == NC) return false;
                else if (c > 32) return true;
            }
        }
    }

    static void ASSERT(boolean assertion, String message) {
        if (!assertion) throw new AssertionError(message);
    }
}


import java.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;

public class Main {

    void solve() {
        int p=ni(),s=ni(),r=ni();
        precompute(1000000);
        long ans=0;
        for(int i=r;i<=s;i++){
            for(int j=1;j<=p && i*1L*j<=s;j++){
                long d=mul(C[p-1][j-1],mul(inv[j],go(p-j,s-i*j,i)));
               // pw.println(C[p-1][j-1]+" "+inv[j]+" "+go(p-j,s-i*j,i));
                ans=add(ans,d);
            }
        }
        ans=mul(ans,fact[p-1]);
        ans=mul(ans,fact[s-r]);
        ans=mul(ans,modInverse(fact[s-r+p-1],M));
        pw.println(ans);

    }

    long go(int n,int m,int s){
        if(n==0) {
            if(m>0) return 0;
            else return 1;
        }
        if((s-1)*1L*n<m) return 0;

        long ans=0;
        for(int i=0;i<=n && s*1L*i<=m;i++){
            if(i%2==0)
            ans=add(ans,mul(C[n][i],C[m-s*i+n-1][n-1]));
            else ans=sub(ans,mul(C[n][i],C[m-s*i+n-1][n-1]));
        }
        return ans;
    }
    long fact[];
    long C[][];
    long inv[];
    void precompute(int n){
        C=new long[5001][5001];
        for(int i=0;i<=5000;i++) C[i][0]=1;
        for(int i=1;i<=5000;i++){
            for(int k=1;k<=i;k++) C[i][k]=add(C[i-1][k-1],C[i-1][k]);
        }
        inv=new long[n+1];
        fact=new long[n+1];
        fact[0]=1;
        for(int i=1;i<=n;i++) fact[i]=mul(fact[i-1],i);
        inv[n]=modInverse(fact[n],M);
        for(int i=n-1;i>=0;i--) inv[i]=mul(inv[i+1],i+1);
        inv[1]=1;
        for(int i=2;i<=n;i++){
            inv[i]=mul(inv[i],fact[i-1]);
        }

    }

    long modpow(long a, long b)
    {
        long r=1;
        while(b>0)
        {
            if((b&1)>0) r=mul(r,a);
            a=mul(a,a);
            b>>=1;
        }
        return r;
    }
    long mul(long x,long y){
        x*=y;
        if(x>=M) x%=M;
        return x;
    }
    long add(long x,long y){
        x+=y;
        if(x>=M) x-=M;
        if(x<0) x+=M;
        return x;
    }
    long sub(long x,long y){
        x-=y;
        if(x<0) x+=M;
        return x;
    }
    long modInverse(long A, long M)
    {

        return modpow(A,M-2);
    }

    long M = 998244353;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";

    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms");

    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

    private void tr(Object... o) {
        if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));
    }

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.lang.Long;
import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * Problem statement: http://codeforces.com/problemset/problem/431/D
 *
 * @author thepham
 *
 */

public class C_Round_91_Div1 {
	static long Mod = 1000000007;

	public static void main(String[] args) throws FileNotFoundException {
		// PrintWriter out = new PrintWriter(new FileOutputStream(new File(
		// "output.txt")));
		PrintWriter out = new PrintWriter(System.out);
		Scanner in = new Scanner();
		int n = in.nextInt();
		int[]data = new int[n];
		for(int i = 0; i < n; i++){
			data[i] = i + 1;
		}
		int k = in.nextInt();
		boolean ok = true;
		if (n <= 14) {
			long max = 1;
			for (int i = 1; i <= n; i++) {
				max *= i;
			}
			if (max < k) {
				ok = false;
				out.println(-1);
			}
		}
		if (ok) {
			PriorityQueue<Long> q = new PriorityQueue();
			TreeSet<Integer> set = new TreeSet();
			q.add(4L);
			q.add(7L);

			while (!q.isEmpty()) {
				long v = q.poll();
				if (v > n) {
					break;
				}
				set.add((int)v);
				q.add(v * 10 + 4);
				q.add(v * 10 + 7);
			}
			//out.println(set);
			int left = 0;
			long cur = 1;
			for(int i = 1; i <= 14 ; i++){
				cur *= i;
				if(cur >= k){
					left = i ;
					break;
				}
			}
			int other = n - left;
			int result = set.headSet(other, true).size();
			int start = other + 1;
			ArrayList<Integer> list = new ArrayList();
			for(int i = 0; i < left; i++){
				list.add(start + i);
			}
			for(int i = 0; i < left; i++){
				int min = 0;
				int max = list.size() - 1;
				long re= -1;
				int id = -1;
				while(min <= max){
					int mid = (min + max)/2;
					long large = mid;
					for(int j = 1; j < left - i; j++ ){
						large *= j;
					}
					if(large < k){
						if(large > re){
							re = large;
							id = mid;
						}
						min = mid + 1;
					}else{
						max = mid - 1;
					}
				}
				k -= re;
				int v = list.remove((int)id);
				//System.out.println(v + " " + id + " " + start + " " + re);
				if(set.contains(v) && set.contains(start)){
					result++;
				}
				start++;
			}
			out.println(result);
		}
		out.close();
	}

	static class Segment implements Comparable<Segment> {
		int x, y;

		public Segment(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		@Override
		public int compareTo(Segment o) {
			if (x != o.x) {
				return x - o.x;
			}
			return o.y - y;
		}
	}

	public static int[] buildKMP(String val) {
		int[] data = new int[val.length() + 1];
		int i = 0;
		int j = -1;
		data[0] = -1;
		while (i < val.length()) {
			while (j >= 0 && val.charAt(i) != val.charAt(j)) {
				j = data[j];
			}
			i++;
			j++;

			data[i] = j;
			// System.out.println(val + " " + i + " " + data[i]);
		}
		return data;
	}

	static int find(int index, int[] u) {
		if (u[index] != index) {
			return u[index] = find(u[index], u);
		}
		return index;
	}

	static int crossProduct(Point a, Point b) {
		return a.x * b.y + a.y * b.x;
	}

	static long squareDist(Point a) {
		long x = a.x;
		long y = a.y;
		return x * x + y * y;
	}

	static Point minus(Point a, Point b) {
		return new Point(a.x - b.x, a.y - b.y);
	}

	public static boolean nextPer(int[] data) {
		int i = data.length - 1;
		while (i > 0 && data[i] < data[i - 1]) {
			i--;
		}
		if (i == 0) {
			return false;
		}
		int j = data.length - 1;
		while (data[j] < data[i - 1]) {
			j--;
		}
		int temp = data[i - 1];
		data[i - 1] = data[j];
		data[j] = temp;
		Arrays.sort(data, i, data.length);
		return true;
	}

	static class Point {
		int x, y;

		public Point(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return "{" + x + " " + y + "}";
		}

	}

	static long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}

	public static class FT {

		int[] data;

		FT(int n) {
			data = new int[n];
		}

		public void update(int index, int value) {
			while (index < data.length) {
				data[index] += value;
				index += (index & (-index));
			}
		}

		public int get(int index) {
			int result = 0;
			while (index > 0) {
				result += data[index];
				index -= (index & (-index));
			}
			return result;

		}
	}

	static class Scanner {

		BufferedReader br;
		StringTokenizer st;

		public Scanner() throws FileNotFoundException {
			// System.setOut(new PrintStream(new
			// BufferedOutputStream(System.out), true));
			br = new BufferedReader(new InputStreamReader(System.in));
			// br = new BufferedReader(new InputStreamReader(new
			// FileInputStream(
			// new File("input.txt"))));
		}

		public String next() {

			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					throw new RuntimeException();
				}
			}
			return st.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

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

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			st = null;
			try {
				return br.readLine();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}

		public boolean endLine() {
			try {
				String next = br.readLine();
				while (next != null && next.trim().isEmpty()) {
					next = br.readLine();
				}
				if (next == null) {
					return true;
				}
				st = new StringTokenizer(next);
				return st.hasMoreTokens();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CF725B {

	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		//OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(System.out);
		String s=in.nextLine();
        int len=s.length()-1;
        long i=Long.parseLong(s.substring(0,len));
        //System.out.println(i);
        char ca=s.charAt(len);
        long x=1;
        long y=3;
        long c=0;
        long cc=0;
        long j=0;
        if(x<=i-4&&y<=i-4)
        {
        	long d=i/4;
        	x=x+(long)4*d;
        	y=y+(long)4*d;
        	c=c+(long)4*d;
        	cc=cc+(long)12*d;
        }
        while(x!=i&&y!=i)
        {
        	if(j%2==0)
        	{
        		x=x+1;
       			y=y+1;
       			c=c+1;
       		}
        	else
        	{
        		x=x+3;
       			y=y+3;
       			c=c+3;
        	}
        	cc=cc+6;
        	j++;
        }
        int a=0;
        if(ca=='f')
        	a=1;
        if(ca=='e')
        	a=2;
        if(ca=='d')
        	a=3;
        if(ca=='a')
        	a=4;
        if(ca=='b')
        	a=5;
        if(ca=='c')
        	a=6;
        long ans=c+cc+(long)a;
        System.out.println(ans);
		out.close();

}
static class Pair implements Comparable<Pair> {
	int u;
	int v;
	BigInteger bi;
	public Pair(int u, int v) {
		this.u = u;
		this.v = v;
	}

	public int hashCode() {
		int hu = (int) (u ^ (u >>> 32));
		int hv = (int) (v ^ (v >>> 32));
		return 31 * hu + hv;
	}

	public boolean equals(Object o) {
		Pair other = (Pair) o;
		return u == other.u && v == other.v;
	}

	public int compareTo(Pair other) {
		return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
	}

	public String toString() {
		return "[u=" + u + ", v=" + v + "]";
	}
}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}
static long modulo(long a,long b,long c) {
	long x=1;
	long y=a;
	while(b > 0){
		if(b%2 == 1){
			x=(x*y)%c;
		}
		y = (y*y)%c; // squaring the base
		b /= 2;
	}
	return  x%c;
}
static long gcd(long x, long y)
{
	if(x==0)
		return y;
	if(y==0)
		return x;
	long r=0, a, b;
	a = (x > y) ? x : y; // a is greater number
	b = (x < y) ? x : y; // b is smaller number
	r = b;
	while(a % b != 0)
	{
		r = a % b;
		a = b;
		b = r;
	}
	return r;
}
static class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream inputstream) {
		reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}

	public String nextLine(){
		String fullLine=null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				fullLine=reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return fullLine;
		}
		return fullLine;
	}
	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
}
}


import java.io.*;
import java.util.*;

public class Main {
    static FastScanner in;
    static long n, ans = 0, c1, c2;
    static char s;

    public static void main(String[] args) throws IOException {
        //        in = new FastScanner("input.txt");
        in = new FastScanner(System.in);
        String inp = in.next();
        s = inp.charAt(inp.length() - 1);
        n = Long.parseLong(inp.substring(0, inp.length() - 1));
        c1 = 1;
        c2 = 3;
        if (n % 4 == 1 || n % 4 == 2) {
            while (c1 < n) {
                if (c1 % 4 == 1) {
                    ans += 7;
                    c1++;
                } else if (c1 % 4 == 2) {
                    ans += 9;
                    c1 += 3;
                }
            }
        } else {
            while (c2 < n) {
                if (c2 % 4 == 3) {
                    ans += 7;
                    c2++;
                } else if (c2 % 4 == 0) {
                    ans += 9;
                    c2 += 3;
                }
            }
        }
        if (s == 'f')
            ans += 1;
        else if (s == 'e')
            ans += 2;
        else if (s == 'd')
            ans += 3;
        else if (s == 'a')
            ans += 4;
        else if (s == 'b')
            ans += 5;
        else if (s == 'c')
            ans += 6;
        System.out.println(ans);
    }
}

class FastScanner {

    BufferedReader br;
    StringTokenizer tokenizer;

    FastScanner(String fileName) throws FileNotFoundException {
        this(new FileInputStream(new File(fileName)));
    }

    FastScanner(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is));
    }

    String nextLine() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    String next() throws IOException {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

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

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}