import java . util . * ; import java . math . * ; import java . text . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String rook = sc . next ( ) ; String knight = sc . next ( ) ; int r = knight . charAt ( 0 ) - ' a ' + 1 ; int c = knight . charAt ( 1 ) - '0' ; boolean m [ ] [ ] = new boolean [ 9 ] [ 9 ] ; int r1 = rook . charAt ( 0 ) - ' a ' + 1 ; int c1 = rook . charAt ( 1 ) - '0' ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ r1 ] [ i ] = true ; for ( int i = 1 ; i <= 8 ; i ++ ) m [ i ] [ c1 ] = true ; int dx [ ] = { 2 , 2 , - 2 , - 2 , 1 , 1 , - 1 , - 1 } ; int dy [ ] = { - 1 , 1 , - 1 , 1 , 2 , - 2 , 2 , - 2 } ; int ans = 0 ; int x = 0 , y = 0 ; m [ r ] [ c ] = true ; for ( int i = 0 ; i < 8 ; i ++ ) { x = r + dx [ i ] ; y = c + dy [ i ] ; if ( x < 1 || y < 1 || x > 8 || y > 8 ) continue ; m [ x ] [ y ] = true ; } for ( int i = 1 ; i <= 8 ; i ++ ) { for ( int j = 1 ; j <= 8 ; j ++ ) { if ( ! m [ i ] [ j ] ) { boolean place = true ; for ( int k = 0 ; k < 8 ; k ++ ) { x = i + dx [ k ] ; y = j + dy [ k ] ; if ( x == r1 && y == c1 ) place = false ; } if ( place ) ans ++ ; } } } System . out . println ( ans ) ; } }


n = 9 chs = [ [ 0 for i in range ( 0 , n ) ] for j in range ( 0 , n ) ] a = input ( ) b = input ( ) lx = ord ( a [ 0 ] ) - 96 ly = int ( a [ 1 ] ) hx = ord ( b [ 0 ] ) - 96 hy = int ( b [ 1 ] ) chs [ hy ] [ hx ] = chs [ ly ] [ lx ] = 1 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if ( ly == i or lx == j ) or ( ( abs ( i - ly ) == 1 and abs ( j - lx ) == 2 ) or ( abs ( i - ly ) == 2 and abs ( j - lx ) == 1 ) ) : chs [ i ] [ j ] = 1 if ( abs ( hy - i ) == 1 and abs ( hx - j ) == 2 ) or ( abs ( hy - i ) == 2 and abs ( hx - j ) == 1 ) : chs [ i ] [ j ] = 1 ans = 0 for i in range ( 1 , n ) : for j in range ( 1 , n ) : if chs [ i ] [ j ] == 0 : ans += 1 print ( ans ) NEW_LINE


import java . util . Scanner ;   public class Chess { static void moveKnight ( boolean [ ] visited , int knight ) { for ( int i = - 1 ; i < 3 ; i += 2 ) {

first = input ( ) second = input ( ) s = " abcdefjh " ans = 0 for i in " abcdefgh " : for j in range ( 1 , 9 ) : move = i + str ( j )   if move != first and move != second : if not i in first and not str ( j ) in first : NEW_LINE


import java . util . Scanner ;     public class MAIN {   public static void main ( String [ ] args ) {


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {         public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; int left = 0 ; int right = n - 1 ; int zero = 0 ; int one = 0 ; long ans = 0 ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) zero ++ ; else one ++ ; if ( one - zero == 0 ) { ans = Math . max ( ans , i + 1 ) ; } else if ( map . containsKey ( one - zero ) ) { ans = Math . max ( ans , i - map . get ( one - zero ) ) ; } else map . put ( one - zero , i ) ; } System . out . println ( ans ) ; }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { 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 ( ) throws IOException { return br . readLine ( ) ; } }   }

n = int ( input ( ) ) s = input ( ) o = [ 0 ] * nz = [ 0 ] * nfor i in range ( n ) : if i == 0 : if s [ i ] == '1' : o [ i ] = 1 else : z [ i ] = 1 else : if s [ i ] == '1' : o [ i ] = o [ i - 1 ] + 1 z [ i ] = z [ i - 1 ] else : z [ i ] = z [ i - 1 ] + 1 o [ i ] = o [ i - 1 ] d = [ ] for i in range ( n ) : d . append ( o [ i ] - z [ i ] )   dd = { } dd . setdefault ( 0 , - 1 ) for i in range ( n ) : if d [ i ] not in dd . keys ( ) : dd . setdefault ( d [ i ] , i ) NEW_LINE


input ( ) instring = input ( ) balance = [ 0 ]   num0 = 0 num1 = 0   for c in instring : if c == "0" : num0 += 1 else : num1 += 1   balance . append ( num0 - num1 )   d = { }   for i in range ( len ( balance ) ) : if balance [ i ] not in d : d [ balance [ i ] ] = i   ans = 0 NEW_LINE


from collections import defaultdictimport sysinput = sys . stdin . readline   n = int ( input ( ) ) s = input ( ) m = defaultdict ( lambda : - 1 ) m [ 0 ] = 0 ans = 0 sum = 0   for i in range ( 1 , n + 1 ) : sum += ( 1 if s [ i - 1 ] == '1' else - 1 ) if ( sum == 0 ) : ans = i elif ( m [ sum ] != - 1 ) : ans = max ( ans , i - m [ sum ] ) else : m [ sum ] = i print ( ans ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class BalancedSubstring {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = Integer . parseInt ( scanner . nextLine ( ) ) ; String s = scanner . nextLine ( ) ; scanner . close ( ) ; int output = solveProblem ( n , s ) ; System . out . println ( output ) ; } private static int solveProblem ( int n , String s ) { int ones = 0 ; int zeroes = 0 ; int [ ] nums = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { char c = s . charAt ( i ) ;


import java . util . * ;   public class BalancedSubstrings { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; input . nextLine ( ) ; String s = input . nextLine ( ) ;   input . close ( ) ;   int [ ] pre = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { if ( s . charAt ( i - 1 ) == '0' ) { pre [ i ] = pre [ i - 1 ] + 1 ; } else { pre [ i ] = pre [ i - 1 ] - 1 ; } }   int [ ] mp = new int [ 2 * n + 1 ] ; mp [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( pre [ i ] < 0 ) { if ( mp [ n + pre [ i ] ] == 0 ) { mp [ n + pre [ i ] ] = i ; } } else if ( pre [ i ] > 0 ) { if ( mp [ pre [ i ] ] == 0 ) { mp [ pre [ i ] ] = i ; } } }   int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( pre [ i ] < 0 ) { ans = Math . max ( ans , i - mp [ n + pre [ i ] ] ) ; } else { ans = Math . max ( ans , i - mp [ pre [ i ] ] ) ; } }   System . out . println ( ans ) ; } }


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws java . lang . Exception {


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int k = in . nextInt ( ) % 10 ; int r = in . nextInt ( ) ; int res = 1 ; int s = k ; while ( s % 10 != 0 && s % 10 != r ) { s = k * ++ res ; } System . out . println ( res ) ; }   }

price , coin = map ( int , input ( ) . split ( ) ) i = 1 while ( price * i ) % 10 != 0 and ( price * i - coin ) % 10 != 0 : i += 1 print ( i ) NEW_LINE


k , r = map ( int , input ( ) . split ( " ▁ " ) ) i , m = 1 , kwhile m % 10 != r and m % 10 != 0 : i += 1 m = k * iprint ( i ) NEW_LINE


a , b = ( int ( i ) for i in input ( ) . split ( ) ) k = 1 c = awhile a % 10 != 0 and a % 10 != b : k += 1 a = c * kprint ( k ) NEW_LINE


[ shovel_price , rest ] = input ( ) . split ( ' ▁ ' ) x = 1 while True : if ( ( x * int ( shovel_price ) ) % 10 == 0 ) or ( ( x * int ( shovel_price ) % 10 == int ( rest ) ) ) : print ( x ) exit ( ) else : x += 1 NEW_LINE


x , y = map ( int , input ( ) . split ( ) ) n = 0 b = Truewhile b : n += 1 if ( n * x - y ) % 10 == 0 or n * x % 10 == 0 : b = Falseprint ( n ) NEW_LINE


import java . util . Scanner ;   public class A732 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int k = scanner . nextInt ( ) , r = scanner . nextInt ( ) ;   for ( int i = 1 ; ; i ++ ) { if ( i * k % 10 == 0 || i * k % 10 == r ) { System . out . println ( i ) ; break ; } } } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; int total = 1 ; int total_temp = 0 ;   while ( true ) { total_temp = total * k ; if ( total_temp % 10 == 0 || total_temp % 10 == r ) { break ; } else { total ++ ; } }   System . out . println ( total ) ; } }


import java . util . Scanner ; import java . util . StringTokenizer ;   public class BuyAShovel { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String line = scanner . nextLine ( ) ;   StringTokenizer stringTokenizer = new StringTokenizer ( line ) ;   int k = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ; int r = Integer . parseInt ( stringTokenizer . nextToken ( ) ) ;   for ( int i = 1 ; i < 100000 ; i ++ ) { int result = ( k * i ) % 10 ;   if ( result == 0 || result == r ) { System . out . println ( i ) ; return ; }   }   } }


import javax . print . attribute . standard . PrinterMessageFromOperator ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ;

n = int ( input ( ) ) for i in range ( n ) : if i % 2 == 0 : if n % 2 == 1 : print ( " WB " * ( ( n // 2 ) - 1 ) + " WBW " ) else : print ( " WB " * ( n // 2 ) ) else : if n % 2 == 1 : print ( " BW " * ( ( n // 2 ) - 1 ) + " BWB " ) else : print ( " BW " * ( n // 2 ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;


import java . util . * ;   public class CodeForces22B { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( i + j ) % 2 == 0 ) { System . out . print ( " W " ) ; } else { System . out . print ( " B " ) ; } } System . out . println ( ) ; } } }


import java . util . * ; import java . lang . * ; import java . io . * ; public class Main { PrintWriter out ; FastReader sc ; long mod = ( long ) ( 1e9 + 7 ) ; long maxlong = Long . MAX_VALUE ; long minlong = Long . MIN_VALUE ; public void sol ( ) { int n = ni ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { for ( int j = 0 ; j < n ; j ++ ) { if ( j % 2 == 0 ) sb . append ( ' W ' ) ; else sb . append ( ' B ' ) ; } } else { for ( int j = 0 ; j < n ; j ++ ) { if ( j % 2 == 0 ) sb . append ( " B " ) ; else sb . append ( " W " ) ; } } sb . append ( " \n " ) ; } pl ( sb ) ; } public static void main ( String [ ] args ) { Main g = new Main ( ) ; g . out = new PrintWriter ( System . out ) ; g . sc = new FastReader ( ) ; int t = 1 ;


import java . util . Collections ;   import java . util . * ; import java . lang . * ; import java . io . * ; import java . util . Arrays ;   public class CodeChef { public static void solve ( String sr ) { if ( sr . length ( ) % 2 != 0 ) { System . out . println ( " - 1" ) ; return ; } int [ ] arr = new int [ 4 ] ; for ( int i = 0 ; i < sr . length ( ) ; i ++ ) { if ( sr . charAt ( i ) == ' L ' ) arr [ 0 ] ++ ; else if ( sr . charAt ( i ) == ' R ' ) arr [ 1 ] ++ ; else if ( sr . charAt ( i ) == ' U ' ) arr [ 2 ] ++ ; else if ( sr . charAt ( i ) == ' D ' ) arr [ 3 ] ++ ; } int count = 0 ; int diff1 = Math . abs ( arr [ 0 ] - arr [ 1 ] ) ; int diff2 = Math . abs ( arr [ 2 ] - arr [ 3 ] ) ; count = Math . min ( diff1 , diff2 ) + Math . abs ( diff1 - diff2 ) / 2 ; System . out . println ( count ) ;   }   public static void main ( String args [ ] ) throws Exception { StringBuilder sb = new StringBuilder ( ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String sr = br . readLine ( ) ; solve ( sr ) ; } }


def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


import sys , mathsys . setrecursionlimit ( 10 ** 8 ) ''' def ▁ fun ( ) : ▁ ▁ ▁ ▁ for ▁ i ▁ in ▁ range ( 16 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ for ▁ j ▁ in ▁ range ( 4 ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ if ▁ i & (1 < < j ) : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( j , end = ' ' ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ print ( ) import ▁ binarytreefrom ▁ collections ▁ import ▁ dequebst ▁ = ▁ binarytree . tree ( height = 4 , is _ perfect = True ) print ( bst ) def ▁ s ( bst ) : ▁ ▁ ▁ ▁ if ▁ bst : ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ bst . left , bst . right ▁ = ▁ bst . right , bst . left ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . right ) ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ s ( bst . left ) s ( bst ) print ( bst ) ''' s = input ( ) x , y = 0 , 0 for i in s : if i == ' L ' : x -= 1 elif i == ' R ' : x += 1 elif i == ' U ' : y += 1 elif i == ' D ' : y -= 1 print ( - 1 if len ( s ) % 2 != 0 else ( abs ( x ) + abs ( y ) ) // 2 ) NEW_LINE


s = input ( ) if len ( s ) % 2 == 1 : print ( - 1 ) else : l = s . count ( ' L ' ) r = s . count ( ' R ' ) u = s . count ( ' U ' ) d = s . count ( ' D ' )   NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ;   public class MemoryAndTrident { 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 ( ) ; String s = sc . next ( ) ; int left = 0 ; int right = 0 ; int up = 0 ; int down = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' L ' ) { left ++ ; } else if ( s . charAt ( i ) == ' R ' ) { right ++ ; } else if ( s . charAt ( i ) == ' D ' ) { down ++ ; } else { up ++ ; } } if ( s . length ( ) % 2 == 1 ) { System . out . println ( " - 1" ) ; } else { int max1 = Math . max ( left , right ) ; int min1 = Math . min ( left , right ) ; int max2 = Math . max ( up , down ) ; int min2 = Math . min ( up , down ) ; int ans1 = max1 + max2 ; int ans2 = min1 + min2 ; System . out . println ( ( ans1 - ans2 ) / 2 ) ; } } }


import java . text . DecimalFormat ; import java . util . stream . LongStream ; import java . util . stream . IntStream ; import java . io . * ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;


import java . util . * ; import java . io . * ; public class B712 { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; static StringTokenizer st ; public static void main ( String [ ] args ) throws IOException { String s = next ( ) ; int up = 0 ; int right = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == ' U ' ) { up ++ ; } else if ( s . charAt ( i ) == ' D ' ) { up -- ; } else if ( s . charAt ( i ) == ' L ' ) { right -- ; } else { right ++ ; } } up = Math . abs ( up ) ; right = Math . abs ( right ) ; if ( ( up + right ) % 2 == 0 ) { pr . println ( ( up + right ) / 2 ) ; } else { pr . println ( - 1 ) ; } pr . close ( ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } static long readLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static int readInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static double readDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static char readCharacter ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } static String readLine ( ) throws IOException { return br . readLine ( ) . trim ( ) ; } }


import java . util . * ; import java . io . * ; public class parakh { public static void swap ( char a [ ] , int i , int j ) { char c = a [ j ] ; a [ j ] = a [ i ] ; a [ i ] = c ; } public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;

num = input ( ) given = input ( )   num = " " . join ( sorted ( num ) )   idx = - 1 for i in range ( len ( num ) ) : if int ( num [ i ] ) > 0 : idx = i break   if idx == - 1 : solution = "0" else : solution = num [ idx ] + num [ : idx ] + num [ idx + 1 : ]   print ( " WRONG _ ANSWER " if solution != given else " OK " ) NEW_LINE


n = sorted ( list ( input ( ) ) )   NEW_LINE


a = list ( input ( ) ) b = list ( input ( ) )   if a . count ( '0' ) == len ( a ) : if ( b . count ( '0' ) == len ( b ) ) : if len ( a ) == len ( b ) : print ( " OK " ) else : print ( " WRONG _ ANSWER " ) else : print ( " WRONG _ ANSWER " )   else :     a . sort ( ) x = a . count ( '0' ) a = [ a [ x ] ] + [ '0' ] * x + a [ x + 1 : ] print ( " OK " if a == b else " WRONG _ ANSWER " )   NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { static final int N = 15 ; static String str1 , str2 ; static Character [ ] arr = new Character [ N ] ; static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ;   public static void main ( String [ ] args ) throws IOException {


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;   public class Main {   public static void main ( String [ ] args ) { FastScanner input = new FastScanner ( ) ; String question = input . next ( ) ; String ans = input . next ( ) ; if ( question . equals ( "0" ) && question . equals ( ans ) ) { System . out . println ( " OK " ) ; return ; } char a [ ] = question . toCharArray ( ) ; Arrays . sort ( a ) ; if ( a [ 0 ] == '0' ) { for ( int i = 0 ; i < question . length ( ) ; i ++ ) { if ( a [ i ] >= '1' && a [ i ] <= '9' ) { char temp = a [ i ] ; a [ i ] = '0' ; a [ 0 ] = temp ; break ; } } } String newQ = new String ( a ) ; if ( newQ . equals ( ans ) ) { System . out . println ( " OK " ) ; } else { System . out . println ( " WRONG _ ANSWER " ) ; } }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { 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 ( ) ) ; } }   }


import java . util . * ; import java . io . * ;   public class a implements Runnable {   static List < Integer > [ ] al ; static int [ ] c ;   static boolean check ( int u , int color , int p ) { for ( int v : al [ u ] ) { if ( v == p ) continue ; if ( color != - 1 && c [ v ] != color ) return false ; if ( ! check ( v , c [ v ] , u ) ) return false ; } return true ;   } public void run ( ) {   try {   FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; al = new ArrayList [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) al [ i ] = new ArrayList < > ( ) ;   int start = - 1 , end = - 1 ; int [ ] [ ] edge = new int [ n ] [ 2 ] ;   for ( int i = 1 ; i < n ; i ++ ) { int u = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; al [ u ] . add ( v ) ; al [ v ] . add ( u ) ; edge [ i - 1 ] [ 0 ] = u ; edge [ i - 1 ] [ 1 ] = v ; }   c = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) c [ i ] = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { if ( c [ edge [ i ] [ 0 ] ] != c [ edge [ i ] [ 1 ] ] ) { start = edge [ i ] [ 0 ] ; end = edge [ i ] [ 1 ] ; break ; } }

import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE


import collectionsimport sys     def read_ints ( ) : return [ int ( x ) for x in sys . stdin . readline ( ) . strip ( ) . split ( ) ]     def main ( ) : N = read_ints ( ) [ 0 ] edges = [ ] vx_to_neighbor_colors = collections . defaultdict ( set ) for _ in range ( N - 1 ) : u , v = read_ints ( ) u -= 1 v -= 1 edges . append ( ( u , v ) ) colors = read_ints ( )   vx_to_cnt = collections . Counter ( ) e_cnt = 0 for e in edges : if colors [ e [ 0 ] ] == colors [ e [ 1 ] ] : continue vx_to_cnt [ e [ 0 ] ] += 1 vx_to_cnt [ e [ 1 ] ] += 1 e_cnt += 1   if e_cnt == 0 : return 1 NEW_LINE


import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE


import java . util . * ; import java . io . * ;   public class a implements Runnable {   static List < Integer > [ ] al ; static int [ ] c ;   static boolean check ( int u , int color , int p ) { for ( int v : al [ u ] ) { if ( v == p ) continue ; if ( color != - 1 && c [ v ] != color ) return false ; if ( ! check ( v , c [ v ] , u ) ) return false ; } return true ;   }    public void run ( ) {   try {   FastScanner sc = new FastScanner ( ) ; int n = sc . nextInt ( ) ; al = new ArrayList [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) al [ i ] = new ArrayList < > ( ) ;   int start = - 1 , end = - 1 ; int [ ] [ ] edge = new int [ n ] [ 2 ] ;   for ( int i = 1 ; i < n ; i ++ ) { int u = sc . nextInt ( ) ; int v = sc . nextInt ( ) ; al [ u ] . add ( v ) ; al [ v ] . add ( u ) ; edge [ i - 1 ] [ 0 ] = u ; edge [ i - 1 ] [ 1 ] = v ; }   c = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) c [ i ] = sc . nextInt ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { if ( c [ edge [ i ] [ 0 ] ] != c [ edge [ i ] [ 1 ] ] ) { start = edge [ i ] [ 0 ] ; end = edge [ i ] [ 1 ] ; break ; } }


import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . math . RoundingMode ; import java . util . * ; import java . util . concurrent . LinkedBlockingDeque ;   import java . util . ArrayList ; import java . util . HashMap ; import java . util . LinkedList ;


import java . util . * ; import java . io . * ; public class Main2 { 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 ; } } static int mod = ( int ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static PrintWriter out = new PrintWriter ( System . out ) ; static List < Integer > tre [ ] ; static int c [ ] ; public static void main ( String [ ] args ) { int t = 1 ;


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; char p = ' a ' ; int c = 1 ; StringBuilder h = new StringBuilder ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( c > 2 ) { if ( p == ' a ' ) p = ' b ' ; else p = ' a ' ; c = 1 ; } h . append ( p ) ;

length = int ( input ( ) ) st = " a " string_len = 1 while True : st = st + " bbaabbaabbaabbaabbaabb " st = st + " aabbaabbaabbaabbaabbaa " string_len += 44 if ( string_len > length ) : break print ( st [ : length ] ) NEW_LINE


from __future__ import division , print_functionfrom collections import * from math import * from itertools import * import osimport sysfrom io import BytesIO , IOBaseimport math NEW_LINE


from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip ''' Notes : ''' def main ( ) : n = int ( input ( ) ) s = ' aabb ' if n <= 4 : print ( s [ : n ] ) return if n % 2 == 0 : if n % 4 == 0 : dummy = n // 4 print ( s * dummy ) else : dummy = ( n - 2 ) // 4 print ( s * dummy + ' aa ' ) else : dummy = n - 1 if dummy % 2 == 0 : if dummy % 4 == 0 : dummy2 = dummy // 4 print ( s * dummy2 + ' a ' ) else : dummy2 = ( dummy - 2 ) // 4 print ( s * dummy2 + ' aab ' )                   NEW_LINE


from __future__ import division , print_functionfrom collections import * from math import * from itertools import * from time import timeimport osimport sysfrom io import BytesIO , IOBase if sys . version_info [ 0 ] < 3 : from __builtin__ import xrange as range from future_builtins import ascii , filter , hex , map , oct , zip ''' Notes : '''   def main ( ) : n = int ( input ( ) ) s = ' aabb ' if n <= 4 : print ( s [ : n ] ) return if n % 2 == 0 : if n % 4 == 0 : dummy = n // 4 print ( s * dummy ) else : dummy = ( n - 2 ) // 4 print ( s * dummy + ' aa ' ) else : dummy = n - 1 if dummy % 2 == 0 : if dummy % 4 == 0 : dummy2 = dummy // 4 print ( s * dummy2 + ' a ' ) else : dummy2 = ( dummy - 2 ) // 4 print ( s * dummy2 + ' aab ' )                   NEW_LINE


n = int ( input ( ) )   v = [ ' a ' , [ ' aa ' , ' bb ' ] , ' aab ' , ' aabb ' ] if n == 1 : print ( ' a ' ) elif n == 2 : print ( ' ab ' ) elif n == 3 : print ( ' aab ' ) elif n == 4 : print ( ' aabb ' ) else : s = ' aabb ' while len ( s ) < n : s += s   print ( s [ : n ] ) NEW_LINE


import java . sql . SQLOutput ; import java . util . * ;   public class Example { static int [ ] dp ;   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; char a [ ] = new char [ n ] ; int m = 97 ; int i = 0 ; while ( i < n ) { a [ i ] = ( char ) ( m ) ; i ++ ; if ( i == n ) break ; a [ i ] = ( char ) ( m ) ; i ++ ; if ( i == n ) break ; a [ i ] = ( char ) ( m + 1 ) ; i ++ ; if ( i == n ) break ; a [ i ] = ( char ) ( m + 1 ) ; i ++ ; }


import java . util . Scanner ;   public class _0692three_palindrome {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s = " " ; while ( s . length ( ) < n ) { s += s + " aabb " ; } System . out . println ( s . substring ( 0 , n ) ) ; }   }


import java . io . * ; import java . util . * ; public class isolatedVertices { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; long n = Long . parseLong ( st . nextToken ( ) ) ; long m = Long . parseLong ( st . nextToken ( ) ) ; System . out . print ( Math . max ( 0 , n - 2L * m ) + " ▁ " ) ; int max = ( int ) Math . ceil ( 0.5 + Math . pow ( 1L + 8L * m , 0.5 ) * 0.5 ) ; if ( m == 0 ) max = 0 ; System . out . println ( Math . max ( n - max , 0 ) ) ; } }

n , m = list ( map ( int , input ( ) . split ( ) ) )   def bin_search ( m ) : o = m + 1 l = 0 while o != l : k = ( o + l ) // 2 if k * ( k - 1 ) >= 2 * m : o = k else : l = k + 1 return o   print ( max ( n - 2 * m , 0 ) , n - bin_search ( m ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) print ( max ( 0 , n - 2 * m ) , end = " ▁ " ) k = 0 while k * ( k - 1 ) // 2 < m : k += 1 print ( n - k ) NEW_LINE


from sys import stdinimport pprint   input_string = list ( map ( int , stdin . readline ( ) . split ( ) ) )   n = input_string [ 0 ] m = input_string [ 1 ]   i = 0   while ( i * ( i - 1 ) ) < m * 2 :   i += 1   NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   ans = 0 u = [ ] s = m   if m > 0 : for j in range ( n ) : if s >= j : s -= j else : if s > 0 : mas = n - ( j + 1 ) break else : mas = n - j break   if m == 0 : mas = nelif m == n * ( n - 1 ) // 2 : mas = 0             print ( max ( 0 , n - ( m * 2 ) ) , mas ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) if m == 0 : ans1 = ans2 = nelse : ans1 = max ( 0 , ( n - 2 * m ) ) i = 1 while m > 0 : m -= i i += 1 ans2 = n - iprint ( ans1 , ans2 ) NEW_LINE


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Fridge {   static Set < Integer > set ; static long tmin ; static int [ ] ar ; static boolean [ ] visited ; public static void dfs ( HashMap [ ] adj , int u , long curcost ) { if ( set . contains ( u ) || curcost > tmin ) { if ( curcost < tmin ) { tmin = curcost ; } return ; } visited [ u ] = true ;


import java . util . Arrays ; import java . util . Scanner ;   public class VasyaAndIsolatedVertices { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long [ ] nm = Arrays . stream ( scanner . nextLine ( ) . split ( " ▁ " ) ) . mapToLong ( Long :: parseLong ) . toArray ( ) ; if ( nm [ 1 ] == 0 ) { System . out . println ( nm [ 0 ] + " ▁ " + nm [ 0 ] ) ; return ; } long [ ] sums = new long [ ( int ) nm [ 0 ] + 2 ] ; for ( int i = 2 ; i <= nm [ 0 ] ; i ++ ) { sums [ i ] = ( long ) i * ( ( long ) i - 1 ) / 2 ; } long min = nm [ 0 ] / 2 >= nm [ 1 ] ? nm [ 0 ] - 2 * nm [ 1 ] : 0 ; int t = Math . abs ( Arrays . binarySearch ( sums , nm [ 1 ] ) ) ; if ( sums [ t ] != nm [ 1 ] ) t -- ; long max = nm [ 0 ] - t ; System . out . println ( min + " ▁ " + max ) ; } }


l = input ( ) . split ( ) n = int ( l [ 0 ] ) m = int ( l [ 1 ] ) vs = [ ] for i in range ( n ) : vs . append ( int ( input ( ) ) ) vs . append ( 10 * * 9 ) vs . sort ( ) hs = [ ] for i in range ( m ) : l = input ( ) . split ( ) if ( int ( l [ 0 ] ) == 1 ) : hs . append ( int ( l [ 1 ] ) ) hs . sort ( ) j = 0 mina = 10 * * 9   for i in range ( n + 1 ) : if ( j < len ( hs ) ) : while ( hs [ j ] < vs [ i ] ) : j += 1 if ( j == len ( hs ) ) : break if ( i + len ( hs ) - j < mina ) : mina = i + len ( hs ) - j   print ( mina )

if __name__ == ' _ _ main _ _ ' : n , m = map ( int , input ( ) . split ( ) ) NEW_LINE


l = input ( ) . split ( ) n = int ( l [ 0 ] ) m = int ( l [ 1 ] ) vs = [ ] for i in range ( n ) : vs . append ( int ( input ( ) ) ) vs . append ( 10 ** 9 ) vs . sort ( ) hs = [ ] for i in range ( m ) : l = input ( ) . split ( ) if ( int ( l [ 0 ] ) == 1 ) : hs . append ( int ( l [ 1 ] ) ) hs . sort ( ) j = 0 mina = 10 ** 9   for i in range ( n + 1 ) : if ( j < len ( hs ) ) : while ( hs [ j ] < vs [ i ] ) : j += 1 if ( j == len ( hs ) ) : break if ( i + len ( hs ) - j < mina ) : mina = i + len ( hs ) - j   print ( mina ) NEW_LINE


import sysinput = sys . stdin . readline   def bs ( num ) : low = 0 high = len ( rows ) - 1 while low < high : mid = ( low + high ) // 2 if rows [ mid ] >= num : high = mid - 1 else : low = mid + 1 if rows [ low ] < num : return len ( rows ) - ( low + 1 ) else : return len ( rows ) - low   n , m = map ( int , input ( ) . split ( ) ) if n == 0 and m == 0 : print ( 0 ) exit ( 0 ) col = [ ] rows = [ ] for i in range ( n ) : col . append ( int ( input ( ) ) ) col . append ( 10 ** 9 ) for i in range ( m ) : temp = list ( map ( int , input ( ) . split ( ) ) ) if temp [ 0 ] == 1 : rows . append ( temp [ 1 ] ) col . sort ( ) rows . sort ( ) ans = 10 ** 9 if len ( rows ) == 0 : print ( 0 ) exit ( 0 ) for i in range ( n + 1 ) : count1 = bs ( col [ i ] ) ans = min ( ans , count1 + i ) print ( ans )       NEW_LINE


# include < bits / stdc ++ . h > # define ll long long # define F first # define S second # define pb push_back # define P push # define fast ios :: sync_with_stdio ( NULL ) ; cin . tie ( 0 ) ; cout . tie ( 0 ) ; using namespace std ; ll n , i , j , k , x , y , z , l , r , mid , q , ans , mod = 998244353 , t , m ; ll a [ 200005 ] , b [ 200005 ] ; vector < ll > v [ 200005 ] ; string s ; char ch ; int main ( ) { fast ans = 1e9 ; cin >> n >> m ; for ( i = 0 ; i < n ; i ++ ) cin >> a [ i ] ; for ( i = 1 ; i <= m ; i ++ ) { cin >> x >> z >> y ; if ( x != 1 ) { m -- ; i -- ; continue ; } b [ i ] = z ; } sort ( a , a + n ) ; sort ( b + 1 , b + m + 1 , greater < ll > ( ) ) ; j = m ; for ( i = 0 ; i < n ; i ++ ) { while ( j && b [ j ] < a [ i ] ) j -- ; ans = min ( ans , i + j ) ; } while ( j && b [ j ] < 1e9 ) j -- ; ans = min ( ans , j + n ) ; cout << ans ; }


import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int sum1 = 0 , sum2 = 0 , sum3 = 0 ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int v , i , j ; int t = 0 ; int cnt = 1 ; for ( i = 0 ; i < n ; i ++ ) { v = sc . nextInt ( ) ; a [ i ] = v ; sum1 += a [ i ] ; } for ( i = 1 ; i < n ; i ++ ) { for ( j = 1 ; j < n ; j ++ ) { if ( a [ j ] > a [ j - 1 ] ) { t = a [ j - 1 ] ; a [ j - 1 ] = a [ j ] ; a [ j ] = t ; } } } for ( i = 0 ; i < n ; i ++ ) { sum2 += a [ i ] ; sum3 = sum1 - sum2 ; if ( sum2 <= sum3 ) { cnt ++ ; } } System . out . println ( cnt ) ; }   }

n = input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( reverse = True ) count = 0 ans = sum ( l ) for i in range ( len ( l ) ) : count += l [ i ] if ( count > ans / 2 ) : print ( i + 1 ) break NEW_LINE


ReadStr = lambda : input ( ) ReadList = lambda : list ( map ( int , input ( ) . split ( ) ) ) ReadInt = lambda : int ( input ( ) ) ReadMultipleValues = lambda : map ( int , input ( ) . split ( ) )   n = ReadInt ( ) coins = sorted ( ReadList ( ) ) [ : : - 1 ] s = 0 count = 0 for i in range ( n ) : if sum ( coins [ i : ] ) < s : break else : s += coins [ i ] count += 1 print ( count ) NEW_LINE


import math   def solve ( ) : n = int ( input ( ) ) array = [ int ( i ) for i in input ( ) . split ( ) ] sum1 , sum2 = 0 , 0   for i in array : sum1 += i   i , count = n - 1 , n array . sort ( reverse = True )   while sum1 > sum2 : sum1 -= array [ i ] sum2 += array [ i ] i -= 1 count -= 1   return count + 1       print ( solve ( ) ) NEW_LINE


import sysinput = sys . stdin . readline   def solve ( n , arr ) : tot = 0 count = 0 arr = sorted ( arr ) [ : : - 1 ] for i in range ( len ( arr ) ) : tot += arr [ i ] count = len ( arr [ : i ] ) if tot > sum ( arr [ i + 1 : ] ) : print ( count + 1 ) return           NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public class FastIO { BufferedReader br ; StringTokenizer st ; public FastIO ( ) {


import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ;   public class Problem66 {   public static void main ( String [ ] args ) {


import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ;


import java . util . Arrays ; import java . util . Scanner ;   public class JavaApplication1 {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] arr = new int [ n ] ; int total = 0 ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = input . nextInt ( ) ; total += arr [ i ] ; } Arrays . sort ( arr ) ; int sumOfCoins = 0 ; int numOfCoins = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { sumOfCoins += arr [ i ] ; numOfCoins ++ ; if ( sumOfCoins > ( total / 2 ) ) break ; } System . out . println ( numOfCoins ) ; input . close ( ) ; } }


import java . util . Arrays ; import java . util . Scanner ;   public class problem94 {   public static void main ( String [ ] args ) {

n , m = input ( ) . split ( " ▁ " ) gradebook = [ ] best = 0 successful_students = [ ]   for i in range ( int ( n ) ) : gradebook . append ( input ( ) )   for i in range ( int ( m ) ) : grades = [ ] NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) success = [ ] inp = [ ] lst = [ [ 0 for i in range ( n ) ] for j in range ( m ) ]   for _ in range ( n ) : inp . append ( input ( ) )   for i in range ( m ) : for j in range ( n ) : lst [ i ] [ j ] = inp [ j ] [ i ]   for j in lst : mx = max ( j ) for i in range ( n ) : if j [ i ] == mx : success . append ( i )   print ( len ( set ( success ) ) ) NEW_LINE


A = input ( ) . split ( ) n , m = int ( A [ 0 ] ) , int ( A [ 1 ] ) X = [ ] result = [ ] for i in range ( n ) : k = int ( input ( ) ) l = list ( map ( int , list ( str ( k ) ) ) ) X . append ( l )   for i in range ( m ) : k = [ ] for j in range ( n ) : k . append ( X [ j ] [ i ] ) l = max ( k ) for j in range ( n ) : if X [ j ] [ i ] == l : result . append ( j ) else : continueprint ( len ( set ( result ) ) )   NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) grades = [ ] for i in range ( n ) : grades . append ( input ( ) ) success = set ( ) for i in range ( m ) : maxiMark , maxStu = 0 , set ( ) for j in range ( n ) : if int ( grades [ j ] [ i ] ) > maxiMark : maxiMark = int ( grades [ j ] [ i ] ) maxStu = set ( ) maxStu . add ( j ) elif int ( grades [ j ] [ i ] ) == maxiMark : maxiMark = int ( grades [ j ] [ i ] ) maxStu . add ( j ) success |= maxStuprint ( len ( success ) ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) x = [ ] d = { } for i in range ( n ) : a = list ( input ( ) ) x . append ( a ) for i in x : for j , k in enumerate ( i ) : d [ j ] = 0 for i in x : for j , k in enumerate ( i ) : d [ j ] = max ( d [ j ] , int ( k ) ) c = 0 for i in x : for j , k in enumerate ( i ) : if int ( k ) == d [ j ] : c += 1 breakprint ( c ) NEW_LINE


import java . util . * ; public class Marks { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ;   int [ ] [ ] arr = new int [ n ] [ m ] ;   int [ ] store = new int [ m ] ; int count = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ;   for ( int j = 0 ; j < m ; j ++ ) { arr [ i ] [ j ] = s . charAt ( j ) - '0' ; if ( s . charAt ( j ) - '0' > store [ j ] ) { store [ j ] = s . charAt ( j ) - '0' ; } } } sc . close ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( arr [ i ] [ j ] == store [ j ] ) { count ++ ; break ; } } }   System . out . println ( count ) ; } }


import java . util . * ; import java . math . * ; import java . lang . * ; import javafx . util . Pair ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] S = new String [ n ] ; int [ ] maxm = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { S [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < m ; i ++ ) { int max = 0 ; for ( int j = 0 ; j < n ; j ++ ) { char c = S [ j ] . charAt ( i ) ; String str = String . valueOf ( c ) ; int temp = Integer . parseInt ( str ) ; if ( temp > max ) max = temp ; } maxm [ i ] = max ; }


import java . util . Scanner ;   public class Experiment { static Scanner sc = new Scanner ( System . in ) ;   public static void main ( String args [ ] ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] arr = new String [ n ] ; int maxi [ ] = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . next ( ) ; for ( int j = 0 ; j < m ; j ++ ) { maxi [ j ] = Math . max ( maxi [ j ] , arr [ i ] . charAt ( j ) ) ; } } int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( maxi [ j ] == arr [ i ] . charAt ( j ) ) { res ++ ; break ; } } } System . out . println ( res ) ;   } }


import java . util . Scanner ;   public class QueriesOnStr { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int m = in . nextInt ( ) ;   while ( m -- > 0 ) { int l = in . nextInt ( ) - 1 , r = in . nextInt ( ) - 1 , k = in . nextInt ( ) % ( r - l + 1 ) ; s = s . substring ( 0 , l ) + s . substring ( r - k + 1 , r + 1 ) + s . substring ( l , r - k + 1 ) + s . substring ( r + 1 ) ; } System . out . println ( s ) ; in . close ( ) ; } }

""" You ▁ are ▁ given ▁ a ▁ string ▁ s ▁ and ▁ should ▁ process ▁ m ▁ queries . ▁ Each ▁ query ▁ is ▁ described ▁ by ▁ two ▁ 1 - based ▁ indices ▁ li , ▁ ri ▁ and ▁ integer ▁ ki . ▁ It ▁ means ▁ that ▁ you ▁ should ▁ cyclically ▁ shift ▁ the ▁ substring ▁ s [ li . . . ▁ ri ] ▁ ki ▁ times . ▁ The ▁ queries ▁ should ▁ be ▁ processed ▁ one ▁ after ▁ another ▁ in ▁ the ▁ order ▁ they ▁ are ▁ given .  One ▁ operation ▁ of ▁ a ▁ cyclic ▁ shift ▁ ( rotation ) ▁ is ▁ equivalent ▁ to ▁ moving ▁ the ▁ last ▁ character ▁ to ▁ the ▁ position ▁ of ▁ the ▁ first ▁ character ▁ and ▁ shifting ▁ all ▁ other ▁ characters ▁ one ▁ position ▁ to ▁ the ▁ right .  For ▁ example , ▁ if ▁ the ▁ string ▁ s ▁ is ▁ abacaba ▁ and ▁ the ▁ query ▁ is ▁ l1  =  3 ,  r1  =  6 ,  k1  =  1 ▁ then ▁ the ▁ answer ▁ is ▁ abbacaa . ▁ If ▁ after ▁ that ▁ we ▁ would ▁ process ▁ the ▁ query ▁ l2  =  1 ,  r2  =  4 ,  k2  =  2 ▁ then ▁ we ▁ would ▁ get ▁ the ▁ string ▁ baabcaa . """ from itertools import chainss = input ( ) n = int ( input ( ) ) for x in range ( n ) : l , r , k = [ int ( y ) for y in input ( ) . split ( ) ] k %= ( r - l + 1 ) l -= 1 ss = ss [ : l ] + ss [ r - k : r ] + ss [ l : r - k ] + ss [ r : ] print ( ss ) NEW_LINE


""" a1 ▁ a2 ▁ a3 ▁ a4 ▁ a5 ▁ a6l ▁ = ▁ 2 , ▁ r ▁ = ▁ 5 , ▁ k ▁ = ▁ 1 ▁ - > ▁ a1 ▁ a2 ▁ a3 ▁ a4 ▁ a5 ▁ a6 """ def rotate_sub ( s , l , r , k ) : sub_size = r - ( l - 1 ) k = k % sub_size if k == 0 : return None rightmost = [ ] for i in range ( r - k , r ) : rightmost . append ( s [ i ] ) for i in range ( r - k - 1 , l - 2 , - 1 ) : s [ i + k ] = s [ i ] for i in range ( len ( rightmost ) ) : s [ l - 1 + i ] = rightmost [ i ]   if __name__ == ' _ _ main _ _ ' : s = list ( input ( ) ) m = int ( input ( ) ) while m : m -= 1 l , r , k = map ( int , input ( ) . split ( ) ) rotate_sub ( s , l , r , k ) print ( ' ' . join ( s ) ) NEW_LINE


s = input ( ) m = int ( input ( ) )   for _ in range ( m ) : l , r , k = map ( int , input ( ) . split ( ) ) l -= 1 r -= 1   k %= ( r - l + 1 )   t = s [ l : r + 1 ] t = t [ - k : ] + t [ : - k ]   s = s [ : l ] + t + s [ r + 1 : ]   print ( s ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : a = list ( input ( ) ) m = int ( input ( ) ) s = " "   while m > 0 : l , r , k = map ( int , input ( ) . split ( ) ) d = r - l + 1   for i in range ( d ) : if ( i + k ) % d == 0 : a = a [ : l - 1 ] + a [ i + l - 1 : r ] + a [ l - 1 : i + l - 1 ] + a [ r : ] break m -= 1 print ( " " . join ( a ) ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : a = list ( input ( ) ) m = int ( input ( ) ) s = " "   while m > 0 : l , r , k = map ( int , input ( ) . split ( ) ) k %= ( r - l + 1 ) a = a [ : l - 1 ] + a [ r - k : r ] + a [ l - 1 : r - k ] + a [ r : ] m -= 1 print ( " " . join ( a ) ) NEW_LINE


import java . io . * ; import java . util . * ;      public class Main { public static Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) , 640000 ) ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;    public static void rotate ( char chrs [ ] , int startIndex , int endIndex , int shiftOffset ) { int length = ( endIndex - startIndex ) + 1 ; char aux [ ] = new char [ length ] ;   for ( int i = 0 ; i < aux . length ; ++ i ) aux [ i ] = chrs [ startIndex + i ] ;   for ( int i = 0 ; i < aux . length ; ++ i ) { int newLocalIndex = ( i + shiftOffset ) % length ; chrs [ newLocalIndex + startIndex ] = aux [ i ] ; }   }    public static void solve ( ) { String s = in . next ( ) ;    char chrs [ ] = s . toCharArray ( ) ;   int m = in . nextInt ( ) ; for ( int i = 0 ; i < m ; ++ i ) { int startIndex = in . nextInt ( ) - 1 ; int endIndex = in . nextInt ( ) - 1 ; int k = in . nextInt ( ) ;   int shiftSize = ( endIndex - startIndex ) + 1 ; int finalShiftOffset = k % shiftSize ;   rotate ( chrs , startIndex , endIndex , finalShiftOffset ) ;      } out . println ( new String ( chrs ) ) ; }   public static void main ( String args [ ] ) { solve ( ) ; out . close ( ) ; } }


import java . io . * ; import java . util . * ;      public class Main { public static Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) , 640000 ) ) ; public static PrintWriter out = new PrintWriter ( System . out ) ;    public static void rotate ( char chrs [ ] , int startIndex , int endIndex , int shiftOffset ) { int length = ( endIndex - startIndex ) + 1 ; char aux [ ] = new char [ length ] ; for ( int i = 0 ; i < aux . length ; ++ i ) aux [ i ] = chrs [ startIndex + i ] ; for ( int i = 0 ; i < aux . length ; ++ i ) { int newLocalIndex = ( i + shiftOffset ) % length ; chrs [ newLocalIndex + startIndex ] = aux [ i ] ; }   }    public static void solve ( ) { String s = in . next ( ) ;    char chrs [ ] = s . toCharArray ( ) ;   int m = in . nextInt ( ) ; for ( int i = 0 ; i < m ; ++ i ) { int startIndex = in . nextInt ( ) - 1 ; int endIndex = in . nextInt ( ) - 1 ; int k = in . nextInt ( ) ;   int shiftSize = ( endIndex - startIndex ) + 1 ; int finalShiftOffset = k % shiftSize ;   rotate ( chrs , startIndex , endIndex , finalShiftOffset ) ;      } System . out . println ( new String ( chrs ) ) ; }   public static void main ( String args [ ] ) { solve ( ) ; out . close ( ) ; } }


import java . io . * ; import java . util . * ; public class Asd { static PrintWriter w = new PrintWriter ( System . out ) ; static FastScanner s = new FastScanner ( ) ; static HashSet < Long > list = new HashSet < > ( ) ; public static void main ( String [ ] args ) {


import java . util . * ;   public class Main { public static void main ( String [ ] args ) { int n , i ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; String s1 = " I ▁ love ▁ " ; String s2 = " I ▁ hate ▁ " ; int flag = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { System . out . print ( s2 ) ; } else { System . out . print ( s1 ) ; } if ( i != n - 1 ) System . out . print ( " that ▁ " ) ; } System . out . print ( " it " ) ; } }

print ( * ( [ ' I ▁ hate ' , ' I ▁ love ' ] * 50 ) [ : int ( input ( ) ) ] , sep = ' ▁ that ▁ ' , end = ' ▁ it ' ) NEW_LINE


n = int ( input ( ) ) for i in range ( 1 , n ) : if i % 2 == 1 : print ( ' I ▁ hate ▁ that ' , end = ' ▁ ' ) else : print ( ' I ▁ love ▁ that ' , end = ' ▁ ' ) if n % 2 == 1 : print ( ' I ▁ hate ▁ it ' , end = ' ▁ ' ) else : print ( ' I ▁ love ▁ it ' , end = ' ▁ ' ) NEW_LINE


n = int ( input ( ) ) f = 1 s = " " for i in range ( n - 1 ) : if f == 1 : s += " I ▁ hate " f = 2 else : s += " I ▁ love " f = 1 s += " ▁ that ▁ " if f == 1 : s += " I ▁ hate ▁ it " else : s += " I ▁ love ▁ it " print ( s ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int n = in . nextInt ( ) ;   for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) System . out . print ( " I ▁ love ▁ " ) ; else System . out . print ( " I ▁ hate ▁ " ) ; if ( i == n ) System . out . print ( " it " ) ; else System . out . print ( " that ▁ " ) ; } } }


import java . util . * ; public class Hulk { public static void main ( String args [ ] ) { int n = 0 ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; String res = " " ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 != 0 ) res = res + " I ▁ hate ▁ " ; else res = res + " I ▁ love ▁ " ; if ( i != n ) res = res + " that ▁ " ; } res = res + " it " ; System . out . println ( res ) ; } }


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


da , db = map ( int , input ( ) . split ( ) ) if da - db == 8 : print ( da , db * 10 ) elif db - da > 1 : print ( - 1 ) elif db - da == 1 : print ( da , db ) elif da == db : print ( da * 10 + 1 , db * 10 + 2 ) else : print ( - 1 ) NEW_LINE


a , b = map ( int , input ( ) . split ( ) )   if a == 9 and b == 1 : print ( 99 , 100 ) elif a == b : print ( 10 * a , 10 * a + 1 ) elif a + 1 == b : print ( 10 * a + 9 , 10 * b ) else : print ( - 1 ) NEW_LINE


na , nb = map ( int , input ( ) . split ( ) )   if na - nb == 8 : print ( 9 , 10 ) elif nb - na == 1 : print ( na * 10 + 9 , nb * 10 )   elif na == nb : print ( na * 10 , nb * 10 + 1 )   else : print ( - 1 )           NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; long a = s . nextLong ( ) ; long b = s . nextLong ( ) ; if ( a == b ) { System . out . print ( ( 10 * a ) + " ▁ " + ( 10 * b + 1 ) ) ; return ; } if ( a + 1 == b ) { System . out . print ( ( 10 * a + 9 ) + " ▁ " + ( 10 * b ) ) ; return ; } if ( b == 1 && a == 9 ) { System . out . print ( 9 + " ▁ " + 10 ) ; return ; } System . out . print ( - 1 ) ; } }


import java . util . Scanner ;   public class ForgettingThings {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ; if ( a == 9 && b == 1 ) { System . out . println ( 9 + " ▁ " + 10 ) ; } else if ( a == b ) { System . out . println ( a + "0 ▁ " + b + "1" ) ; } else if ( a + 1 == b ) { System . out . println ( a + " ▁ " + b ) ; } else { System . out . println ( " - 1" ) ; } }   }


import java . util . * ; public class contest13 { static Scanner scn = new Scanner ( System . in ) ; public static void main ( String [ ] args ) {

f = 1 r , n = map ( int , input ( ) . split ( ) ) for x in range ( r ) : s = input ( ) s1 = len ( s ) s2 = len ( s ) if f == 1 : for i in range ( len ( s ) ) : if s [ i ] == " B " and f == 1 : s1 = i   f = 0   p = x NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) matrix = [ ] for i in range ( n ) : row = list ( str ( input ( ) ) ) matrix . append ( row ) for j in range ( n ) : for k in range ( m ) : if ( matrix [ j ] [ k ] == " B " ) : c = j d = kfor p in reversed ( range ( n ) ) : for q in reversed ( range ( m ) ) : if ( matrix [ p ] [ q ] == " B " ) : f = p g = qr = int ( ( c + f ) / 2 ) s = int ( ( d + g ) / 2 ) print ( r + 1 , " ▁ " , s + 1 ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) )   matrix = [ ]   find_B_start = TrueB_col_start = B_row_start = B_side = 0   for i in range ( n ) : row = list ( str ( input ( ) ) ) for j in range ( m ) : if row [ j ] == ' B ' : if ( find_B_start ) : B_col_start = j + 1 B_row_start = i + 1 find_B_start = False B_side += 1 break   middle_x = B_col_start + ( B_side // 2 ) middle_y = B_row_start + ( B_side // 2 )   print ( middle_y , end = ' ▁ ' ) print ( middle_x )                                 NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) v = Falsefor i in range ( n ) : row = input ( ) if not v and ' B ' in row : s , e = row . find ( ' B ' ) , row . rfind ( ' B ' ) c = ( s + e ) // 2 r = i + c - s v = True print ( r + 1 , c + 1 ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class Codeforces {   private static final Scanner sc = new Scanner ( System . in ) ; private static final BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; private static final long MOD = ( long ) ( 1e9 + 7 ) ;   public static int [ ] LPS ( String p ) { int [ ] lps = new int [ p . length ( ) ] ;   int i = 1 ; int j = 0 ; while ( i < p . length ( ) ) { if ( p . charAt ( i ) == p . charAt ( j ) ) { lps [ i ] = j + 1 ; i ++ ; j ++ ; } else { if ( j == 0 ) { lps [ i ] = 0 ; i ++ ; } else { j = lps [ j - 1 ] ; } } } return lps ; }   public static void KMP ( String text , String pattern ) { int [ ] lps = LPS ( pattern ) ; int i = 0 ; int j = 0 ; ArrayList < Integer > matches = new ArrayList < > ( ) ; while ( i < text . length ( ) ) { if ( text . charAt ( i ) == pattern . charAt ( j ) ) { i ++ ; j ++ ; } else { if ( j != 0 ) { j = lps [ j - 1 ] ; } else { i ++ ; } } if ( j == pattern . length ( ) ) { matches . add ( i - j ) ; j = lps [ j - 1 ] ; } } for ( int x : matches ) { System . out . println ( " Match ▁ at ▁ : ▁ " + x ) ; } }   private static class SegmentTree { private long [ ] st ; private int size ; private int n ; private long [ ] a ; SegmentTree ( long [ ] a , int n ) { this . size = 4 * n ; this . n = n ; this . a = a ; st = new long [ size ] ;


import java . util . * ; import java . util . Arrays ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int L1 = - 1 , R1 = - 1 , L2 = - 1 , R2 = - 1 ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String [ ] table = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { table [ i ] = sc . next ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( table [ i ] . charAt ( j ) == ' B ' ) { if ( L1 == - 1 ) { L2 = i ; L1 = i ; R2 = j ; R1 = j ; } else if ( i > L2 && j > R2 ) { L2 = i ; R2 = j ; } } } } System . out . println ( ( L1 + L2 + 2 ) / 2 + " ▁ " + ( R1 + R2 + 2 ) / 2 ) ; } }


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; sc . nextLine ( ) ; int x = 0 ; int y = - 1 ; int count = 0 ; int startindex = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . nextLine ( ) ; if ( x == 1 ) continue ; if ( s . contains ( " B " ) ) { x = 1 ; if ( startindex == - 1 ) startindex = i ;   for ( int j = 0 ; j < s . length ( ) ; j ++ ) { if ( s . charAt ( j ) == ' B ' ) {


import javax . swing . plaf . IconUIResource ; import java . io . * ; import java . lang . ref . SoftReference ; import java . math . BigInteger ; import java . nio . file . LinkOption ; import java . util . * ;

def answer ( n , a ) : for i in range ( n ) : while a [ i ] % 2 == 0 : a [ i ] //= 2 while a [ i ] % 3 == 0 : a [ i ] //= 3 for i in range ( 1 , n ) : if a [ i - 1 ] != a [ i ] : return ' No '   return ' Yes '       return   def main ( ) : n = int ( input ( ) ) a = [ int ( i ) for i in input ( ) . split ( ) ] print ( answer ( n , a ) ) main ( ) NEW_LINE


from math import gcdn = int ( input ( ) ) ; arr = list ( map ( int , input ( ) . split ( ) ) ) s = set ( ) for i in arr : while i % 2 == 0 : i = i // 2 while i % 3 == 0 : i = i // 3 s . add ( i ) if len ( s ) != 1 : print ( " NO " ) else : print ( " YES " ) NEW_LINE


from math import ceil , sqrt , floor   def isPerfectSquare ( x ) : NEW_LINE


import sysinput = sys . stdin . readline   n = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ]   pos = set ( [ ] )   for z in arr : while ( z % 2 == 0 ) : z //= 2 while ( z % 3 == 0 ) : z //= 3 pos . add ( z ) if len ( pos ) != 1 : print ( " No " ) else : print ( " Yes " ) NEW_LINE


import java . util . Scanner ;   public class BearAndPoker { public static void main ( String [ ] args ) { Scanner xScanner = new Scanner ( System . in ) ; int n = xScanner . nextInt ( ) ; int [ ] bids = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { bids [ i ] = xScanner . nextInt ( ) ; bids [ i ] = removePrimeFactors2And3 ( bids [ i ] ) ; if ( i > 0 && bids [ i ] != bids [ i - 1 ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; }   private static int removePrimeFactors2And3 ( int num ) {


import java . util . Scanner ;   public class BearAndPoker { public static void main ( String [ ] args ) { Scanner xScanner = new Scanner ( System . in ) ; int n = xScanner . nextInt ( ) ; int [ ] bids = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { bids [ i ] = xScanner . nextInt ( ) ; removePrimeFactors2And3 ( bids , i ) ; if ( i > 0 && bids [ i ] != bids [ i - 1 ] ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; }   private static void removePrimeFactors2And3 ( int [ ] bids , int i ) {


import java . util . Scanner ;   public class BearAndPoker { public static void main ( String [ ] args ) { Scanner xScanner = new Scanner ( System . in ) ; int n = xScanner . nextInt ( ) ; int [ ] bids = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { bids [ i ] = xScanner . nextInt ( ) ;


import java . util . * ; import java . io . * ; import java . math . * ; public class Euler { public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ; PrintWriter o = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) ; char [ ] ch = in . next ( ) . toCharArray ( ) ; char [ ] ans = new char [ ch . length ] ; Arrays . fill ( ans , '9' ) ; for ( int i = 0 ; i <= 9 ; i ++ ) { char [ ] ch1 = new char [ ch . length ] ; for ( int j = 0 ; j < n ; j ++ ) { int val = ch [ j ] - '0' ; val = ( val + i ) % 10 ; ch1 [ j ] = ( char ) ( val + '0' ) ; } for ( int j = 0 ; j < n ; j ++ ) { char [ ] ch2 = new char [ ch . length ] ; for ( int k = 0 ; k < n ; k ++ ) { ch2 [ ( k + j ) % n ] = ch1 [ k ] ; } ans = compare ( ans , ch2 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { o . print ( ans [ i ] ) ; } o . println ( ) ; o . close ( ) ; o . flush ( ) ; return ; } public static char [ ] compare ( char [ ] ch1 , char [ ] ch2 ) { for ( int i = 0 ; i < ch1 . length ; i ++ ) { int val1 = ch1 [ i ] - '0' ; int val2 = ch2 [ i ] - '0' ; if ( val1 < val2 ) { return ch1 ; } if ( val2 < val1 ) { return ch2 ; } } return ch1 ; } static final Random random = new Random ( ) ; static void ruffleSort ( int [ ] a ) { int n = a . length ;

def STR ( ) : return list ( input ( ) ) def INT ( ) : return int ( input ( ) ) def MAP ( ) : return map ( int , input ( ) . split ( ) ) def MAP2 ( ) : return map ( float , input ( ) . split ( ) ) def LIST ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def STRING ( ) : return input ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


n = int ( input ( ) ) a = list ( input ( ) ) ans = afor i in range ( 10 ) : for j in range ( n ) : if a < ans : ans = a a = a [ 1 : ] + [ a [ 0 ] ] for j in range ( n ) : a [ j ] = str ( ( int ( a [ j ] ) + 1 ) % 10 ) print ( " " . join ( ans ) ) NEW_LINE


from ast import NameConstantimport bisectimport sysimport mathdef input ( ) : return sys . stdin . readline ( ) . strip ( ) def iinput ( ) : return int ( input ( ) ) def minput ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def listinput ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) ) ) number_possible = [ ] while True : for i in range ( n ) : a [ i ] += 1 if a [ i ] == 10 : a [ i ] = 0 s = ' ' for i in range ( n ) : s += str ( a [ i ] ) if s not in number_possible : number_possible . append ( s ) else : breakfor i in range ( len ( number_possible ) ) : temp = number_possible [ i ] possible = [ temp ] while True : temp = temp [ 1 : ] + temp [ : 1 ] if temp not in possible : possible . append ( temp ) else : break number_possible [ i ] = min ( possible ) print ( min ( number_possible ) ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . * ;   public class B639 { public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;

import sys , os , ioimport math , bisect , operatorinf , mod = float ( ' inf ' ) , 10 ** 9 + 7 NEW_LINE


n , d , h = map ( int , input ( ) . split ( ) ) if d > h * 2 : print ( - 1 ) ; exit ( ) if n > 2 and h == 1 and d == 1 : print ( - 1 ) ; exit ( ) cnt = 0 cur = 1   for i in range ( 1 , h + 1 ) : print ( cur , cur + 1 ) cur += 1 cnt += 1 remain = d - hif remain : cur += 1 ; print ( 1 , cur ) ; remain -= 1 ; cnt += 1 else : cur += 1 while cnt + 1 < n : print ( 2 , cur ) cur += 1 cnt += 1 if remain > 0 : while remain > 0 : print ( cur , cur + 1 ) cnt += 1 cur += 1 remain -= 1 cur += 1 else : cur += 1 while cnt + 1 < n : print ( 1 , cur ) cur += 1 cnt += 1 NEW_LINE


n , d , h = list ( map ( int , input ( ) . split ( ) ) ) if 2 * h < d or ( h == d == 1 and n > 2 ) : print ( - 1 ) else : ans = [ ] z = 1 for i in range ( h ) : ans . append ( ( i + 1 , i + 2 ) ) z = i + 2 k = d - h if k > 0 : ans . append ( ( 1 , z + 1 ) ) z += 1 k -= 1 NEW_LINE


n , d , h = map ( int , input ( ) . split ( ) ) if n == 2 : if d == h and d == 1 : print ( '1 ▁ 2' ) else : print ( - 1 ) elif d == 1 or d > 2 * h : print ( - 1 ) else : for i in range ( h ) : print ( i + 1 , i + 2 ) for i in range ( d - h ) : print ( 1 if i == 0 else i + h + 1 , i + h + 2 ) for i in range ( d + 1 , n ) : print ( 2 if d == h else 1 , i + 1 )     NEW_LINE


import math , sys , bisect , heapq , osfrom collections import defaultdict , Counter , dequefrom itertools import groupby , accumulatefrom functools import lru_cache NEW_LINE


import java . util . * ; import java . io . * ;    public class Forces {   public static PrintWriter cout ; public static void main ( String ... arg ) {


import java . util . * ; import java . io . * ;    public class Forces {   public static PrintWriter cout ; public static void main ( String ... arg ) { Read cin = new Read ( ) ;


import java . util . * ; import java . util . Scanner ; import java . io . * ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class B639 {   public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; int tc = 1 ;


import java . util . Scanner ;   public class n363B { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ; int [ ] fence = new int [ n ] ; int a ; for ( int i = 0 ; i < n ; i ++ ) { a = scanner . nextInt ( ) ; if ( i == 0 ) fence [ i ] = a ; else fence [ i ] = fence [ i - 1 ] + a ; } int min = fence [ k - 1 ] ; int index = 1 ; int result ; for ( int i = 1 ; i < n - k + 1 ; i ++ ) { result = fence [ i + k - 1 ] - fence [ i - 1 ] ; if ( result < min ) { min = result ; index = i + 1 ; } } System . out . println ( index ) ; } }

def solution ( ) : n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) sol = [ 0 ] * ( n - k + 1 ) sol [ 0 ] = sum ( arr [ : k ] ) mn = sol [ 0 ] idx = 1 for i in range ( 1 , n - k + 1 ) : sol [ i ] = sol [ i - 1 ] - arr [ i - 1 ] + arr [ i + k - 1 ] if sol [ i ] < mn : mn = sol [ i ] idx = i + 1 print ( idx )   	     returnsolution ( ) NEW_LINE


import pdb   def solve ( n , k , fence ) : res = 0 val = sum ( fence [ : k ] ) mn = val for l , r in zip ( range ( 1 , n ) , range ( k , n ) ) : val -= fence [ l - 1 ] val += fence [ r ] if val < mn : res = l mn = val print ( res + 1 )   def main ( ) : n , k = map ( int , input ( ) . split ( ) ) fence = list ( map ( int , input ( ) . split ( ) ) ) solve ( n , k , fence )   if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) s = 0 a = [ ] if n == 1 : print ( 1 ) else : for i in range ( k ) : a . append ( l [ i ] ) s += l [ i ] mn = s ans = k - 1 NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) a = { } c = 0 d = 0 b = sum ( m [ : k ] ) for i in range ( n - k + 1 ) : b = b + c - d a [ b ] = i + 1 d = m [ i ] c = m [ i + k - 1 * ( i == n - k ) ] print ( a [ min ( a ) ] ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . List ; import java . util . StringTokenizer ;   public class Fence { static class RealScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }   public static void main ( String [ ] args ) { RealScanner sc = new RealScanner ( ) ; int n , k ; n = sc . nextInt ( ) ; k = sc . nextInt ( ) ; List < Integer > l = new ArrayList < > ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { l . add ( sc . nextInt ( ) ) ; sum += l . get ( i ) ; }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class B363_Fence {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer stt = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( stt . nextToken ( ) ) ; int k = Integer . parseInt ( stt . nextToken ( ) ) ; int [ ] arr = new int [ n ] ; stt = new StringTokenizer ( br . readLine ( ) ) ; int min = Integer . MAX_VALUE ; int index = 1 ; for ( int i = 0 ; i < n ; ++ i ) { arr [ i ] = Integer . parseInt ( stt . nextToken ( ) ) + ( i == 0 ? 0 : arr [ i - 1 ] ) ; if ( i >= k - 1 ) { if ( i == k - 1 ) { min = arr [ i ] ; index = 1 ; } else { int can = arr [ i ] - arr [ i - k ] ; if ( can < min ) { min = can ; index = i - k + 2 ; } } }   }


import java . util . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; int sum = 0 , d = 0 , k1 = k - 1 ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < k ; i ++ ) sum = sum + arr [ i ] ; int temp = sum ; for ( int i = k ; i < n ; i ++ ) { sum = sum + arr [ i ] - arr [ i - k ] ;


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k = sc . nextInt ( ) ; sc . nextLine ( ) ; for ( int i = 2 ; i <= k + 1 ; i ++ ) { String na = sc . nextLine ( ) ; int l = na . length ( ) ; if ( na . length ( ) > 10 ) { na = na . charAt ( 0 ) + String . valueOf ( l - 2 ) + na . charAt ( na . length ( ) - 1 ) ; } System . out . println ( na ) ; } } }

n = int ( input ( ) ) NEW_LINE if 1 <= n <= 100 : for NEW_LINE i in range ( n ) : words = input ( ) NEW_LINE if len ( words ) > 10 : NEW_LINE INDENT print ( words [ 0 ] + str ( len ( words ) - 2 ) + words [ - 1 ] ) else : NEW_LINE print ( words ) NEW_LINE DEDENT


for _ in range ( int ( input ( ) ) ) : line = input ( ) NEW_LINE length = len ( line ) NEW_LINE print ( ( line [ 0 ] + str ( length - 2 ) + line [ - 1 ] ) if length > 10 else line ) NEW_LINE


a = int ( input ( ) ) NEW_LINE for i in range ( a ) : x = input ( ) NEW_LINE if ( len ( x ) > 10 ) : NEW_LINE INDENT print ( x [ 0 ] + str ( len ( x ) - 2 ) + x [ - 1 ] ) else : NEW_LINE print ( x )                   NEW_LINE DEDENT


n = int ( input ( ) ) NEW_LINE for i in range ( n ) : str1 = input ( ) NEW_LINE if len ( str1 ) > 10 : NEW_LINE INDENT print ( str1 [ 0 ] + str ( len ( str1 ) - 2 ) + str1 [ - 1 ] ) else : NEW_LINE print ( str1 ) NEW_LINE DEDENT


l = [ ] NEW_LINE n = int ( input ( " " ) ) NEW_LINE for i in range ( n ) : x = input ( " " ) NEW_LINE l . append ( x ) NEW_LINE for i in l : if NEW_LINE len ( i ) <= 10 : print ( i ) else : s = " " NEW_LINE s = s + i [ 0 ] NEW_LINE s = s + str ( len ( i ) - 2 ) NEW_LINE s = s + i [ len ( i ) - 1 ] NEW_LINE print ( s ) NEW_LINE


import java . io . * ; public class sol { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; String a [ ] = new String [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String line = br . readLine ( ) ; if ( line . length ( ) > 10 ) { a [ i ] = " " + line . charAt ( 0 ) + ( line . length ( ) - 2 ) + line . charAt ( line . length ( ) - 1 ) ; } else { a [ i ] = line ; } } for ( int i = 0 ; i < a . length ; i ++ ) { System . out . println ( a [ i ] ) ; } } }


import java . io . * ; import java . util . * ; import java . lang . * ; import java . util . Random ; public class Main { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner scan = new Scanner ( System . in ) ; int repeat = scan . nextInt ( ) ; while ( repeat -- > 0 ) { String test = scan . next ( ) ; int len = test . length ( ) ; if ( len <= 10 ) { System . out . println ( test ) ; } else { String val = " " + ( test . length ( ) - 2 ) ; String str = test . charAt ( 0 ) + val + test . charAt ( test . length ( ) - 1 ) ; System . out . println ( str ) ; } } } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { String str = scanner . next ( ) ; if ( str . length ( ) > 10 ) { System . out . println ( " " + str . charAt ( 0 ) + ( str . length ( ) - 2 ) + str . charAt ( str . length ( ) - 1 ) ) ; } else { System . out . println ( str ) ; } } } }


import java . util . Scanner ;   public class WayTooLongWords {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int i1 = scan . nextInt ( ) ; String [ ] strings = new String [ i1 ] ; for ( int i = 0 ; i < i1 ; i ++ ) { strings [ i ] = scan . next ( ) ; } String curr ; int length ;   for ( int i = 0 ; i < i1 ; i ++ ) { if ( strings [ i ] . length ( ) > 10 ) { curr = strings [ i ] ; length = curr . length ( ) ; System . out . println ( String . valueOf ( curr . charAt ( 0 ) ) + ( length - 2 ) + String . valueOf ( curr . charAt ( length - 1 ) ) ) ; } else { System . out . println ( strings [ i ] ) ; } } }   }


import java . util . * ; import java . io . * ;   public class Bits {   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 shuffle ( int [ ] a ) { Random r = new Random ( ) ;   for ( int i = 0 ; i <= a . length - 2 ; i ++ ) { int j = i + r . nextInt ( a . length - i ) ;   swap ( a , i , j ) ; }   Arrays . sort ( a ) ; }   public static void swap ( int [ ] a , int i , int j ) { int temp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = temp ; }   public static void main ( String [ ] args ) {

n = int ( input ( ) )   def count ( num ) : ct = 0 for i in range ( len ( num ) ) : if num [ i : i + 1 ] == '1' : ct += 1 return ct   for i in range ( n ) : line = input ( ) . split ( ) a = int ( line [ 0 ] ) b = int ( line [ 1 ] ) if a == b : print ( a ) continue   l = bin ( a ) [ 2 : : ] u = bin ( b ) [ 2 : : ]   while len ( l ) < 60 : l = '0' + l while len ( u ) < 60 : u = '0' + u start = '1' * 60   end = " " for j in range ( 59 ) : charL = l [ j : j + 1 ] charU = u [ j : j + 1 ]   if charL == charU and charL == '0' : end += '0' continue if charL != charU : end += '0' + start [ j + 1 : : ] break end += '1' NEW_LINE


def solve ( l , r ) : i = 62 while i >= 0 and l & ( 1 << i ) == r & ( 1 << i ) : i -= 1 if i < 0 : return l for c in [ r | ( ( 1 << ( i + 1 ) ) - 1 ) , l | ( ( 1 << i ) - 1 ) ] : if c <= r : return c     n = int ( input ( ) ) for _ in range ( n ) : l , r = map ( int , input ( ) . split ( ) ) print ( solve ( l , r ) ) NEW_LINE


import math , sysfrom collections import defaultdict , dequeimport bisect as bidef yes ( ) : print ( ' YES ' ) def no ( ) : print ( ' NO ' ) def I ( ) : return ( int ( sys . stdin . readline ( ) ) ) def In ( ) : return ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def Sn ( ) : return sys . stdin . readline ( ) . strip ( ) def Pr ( x ) : sys . stdout . write ( str ( x ) + ' \n ' ) NEW_LINE


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


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Set ;   public class CWeakenedCommonDivisor {   static int MAX = 1000000 ; static int SQRT = 1000 ; static ArrayList < Integer > primes = new ArrayList < > ( ) ; static boolean [ ] marked = new boolean [ MAX + 1 ] ; static ArrayList < Integer > factors = new ArrayList < > ( ) ;   static void sieve ( ) { marked [ 1 ] = true ; int i = 2 ; for ( ; i < SQRT ; i ++ ) { if ( ! marked [ i ] ) { primes . add ( i ) ; for ( int j = i * i ; j <= MAX ; j += i ) { marked [ j ] = true ; } } } for ( ; i <= MAX ; i ++ ) { if ( ! marked [ i ] ) { primes . add ( i ) ; } } }   public static void primeFactors ( int n ) { factors . clear ( ) ; for ( int i = 0 , p = primes . get ( i ) ; p * p <= n ; p = primes . get ( ++ i ) ) { while ( n % p == 0 ) { factors . add ( p ) ; n /= p ; } } if ( n > 1 ) { factors . add ( n ) ; } }   public static void main ( String [ ] args ) throws IOException {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; sieve ( ) ; Set < Integer > union = null ; for ( int i = 0 ; i < n ; i ++ ) { String [ ] spl = br . readLine ( ) . split ( " ▁ " ) ; int a = Integer . parseInt ( spl [ 0 ] ) ; int b = Integer . parseInt ( spl [ 1 ] ) ; if ( i == 0 ) { union = new HashSet < Integer > ( ) ; primeFactors ( a ) ; union . addAll ( factors ) ; primeFactors ( b ) ; union . addAll ( factors ) ; } else {

from collections import defaultdict , deque , Counterfrom sys import stdin , stdoutfrom heapq import heappush , heappopimport mathimport ioimport osimport mathimport bisect   NEW_LINE


import functoolsimport timefrom collections import Counter   def timer ( func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : stime = time . perf_counter ( ) res = func ( * args , ** kwargs ) elapsed = time . perf_counter ( ) - stime print ( f " { func . _ _ name _ _ } ▁ in ▁ { elapsed : .4f } ▁ secs " ) return res return wrapper   class solver : NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; public class er10a {


import java . util . * ;   public class CodeForces1504C { static Set < Integer > set = new HashSet < > ( ) ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; b [ i ] = input . nextInt ( ) ; } divisor ( a [ 0 ] ) ; divisor ( b [ 0 ] ) ; int count = 0 ; for ( int m : set ) { boolean bool = true ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] % m != 0 && b [ i ] % m != 0 ) { bool = false ; break ; } } if ( bool ) { System . out . println ( m ) ; return ; } }   System . out . println ( - 1 ) ; }    public static void divisor ( int x ) { int y = x ; for ( int i = 2 ; i <= Math . sqrt ( x ) ; i ++ ) { boolean bool = false ; while ( y % i == 0 ) { y /= i ; bool = true ; }   if ( bool ) { set . add ( i ) ; } } if ( y != 1 ) { set . add ( y ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   import java . util . Scanner ; import java . util . StringTokenizer ;    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 int zeroes ( int n ) { int count = 0 ; while ( n > 0 ) { n /= 5 ; count += n ; } return count ; } public static void binarySearch ( int n ) { int low = 0 ; int high = Integer . MAX_VALUE ; while ( low < high ) { int middle = ( low + high ) / 2 ; int count = zeroes ( middle ) ; if ( count < n ) { low = middle + 1 ; } else { high = middle ; } } int ans [ ] = new int [ 1000 ] ; int k = 0 ; while ( zeroes ( low ) == n ) { ans [ k ] = low ; k ++ ; low ++ ; } System . out . println ( k ) ; for ( int i = 0 ; i < k ; i ++ ) { System . out . print ( ans [ i ] + " ▁ " ) ; } }    public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; binarySearch ( n ) ; }   }

m = int ( input ( ) ) count = 0 i = n = 5 arr = [ ] while count <= m : while n % 5 == 0 : count += 1 n //= 5 if count == m : arr . append ( i ) i += 1 n = iif arr == [ ] : print ( 0 ) else : print ( 5 ) print ( * arr ) NEW_LINE


m = int ( input ( ) ) x , z = 5 , 0 while z < m : n = x while n % 5 == 0 : z += 1 n /= 5 x += 5 print ( f ' {5 } \n { x - 5 } ▁ { x - 4 } ▁ { x - 3 } ▁ { x - 2 } ▁ { x - 1 } ' if z == m else 0 ) NEW_LINE


n0 = lambda n : sum ( n // 5 ** i for i in range ( 1 , 64 ) ) n = int ( input ( ) )   l , r , x = 0 , 4000006 , 0 while l <= r : m = ( l + r ) // 2 k = n0 ( m ) if n == k : x = m r = m - 1 elif n > k : l = m + 1 else : r = m - 1   print ( f ' {5 } \n { x } ▁ { x + 1 } ▁ { x + 2 } ▁ { x + 3 } ▁ { x + 4 } ' if n0 ( x ) == n else 0 ) NEW_LINE


def findTrailingZeros ( t ) : count = 0 i = 5 while ( t / i >= 1 ) : count += int ( t / i ) i *= 5 return int ( count ) m = int ( input ( ) ) k = 0 N_list = list ( ) for i in range ( 0 , 500000 ) : t = findTrailingZeros ( i ) if ( t == m ) : k = k + 1 N_list . append ( i ) print ( k ) for i in N_list : print ( i , end = " ▁ " ) NEW_LINE


m = int ( input ( ) ) if m == 0 : print ( 1 , 2 , 3 , 4 ) else : ans = [ 1 ] i = 10 while ans [ - 1 ] < m : cnt = 0 num = i while num % 5 == 0 : num //= 5 cnt += 1 i += 5 ans . append ( cnt + ans [ - 1 ] ) if ans [ - 1 ] == m : print ( 5 ) ln = len ( ans ) for k in range ( ln * 5 , ( ln * 5 ) + 5 ) : print ( k , end = " ▁ " ) else : print ( 0 ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ; import java . lang . Math . * ;   public class Main { public static void main ( String [ ] args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; long m = sc . nextLong ( ) ; long x = 5 ; long s = 0 ; long w = 0 ; long y = 0 ; while ( s < m ) { long r ; for ( long t = 1 ; t <= 100000 ; t ++ ) { r = x * t ; while ( r % 5 == 0 ) { s ++ ; r = r / 5 ; } if ( s > m ) { w = 1 ; break ; } else if ( s == m ) { w = 0 ; y = t ; break ; } } } long q = 5 * y ; if ( w == 0 ) { System . out . println ( "5" ) ; for ( int i = 0 ; i < 5 ; i ++ ) { System . out . print ( q + " ▁ " ) ; q ++ ; } } else { System . out . println ( "0" ) ; } } }


import java . util . * ;   public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ;


import java . util . Scanner ;   public class LCMWall { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int x = scanner . nextInt ( ) ; int y = scanner . nextInt ( ) ;   int a = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ;   int comm = lcm ( x , y ) ; long ans = ( ( b - b % comm ) - ( a - a % comm ) ) / comm ;   if ( a % comm == 0 ) ans ++ ;   System . out . println ( ans ) ; }   public static int gcf ( int x , int y ) { if ( y == 0 ) return x ;   return gcf ( y , x % y ) ; }   public static int lcm ( int x , int y ) { return x * y / gcf ( x , y ) ; } }

import math   x , y , a , b = map ( int , input ( ) . split ( ) ) l = x * y // math . gcd ( x , y ) print ( b // l - ( a - 1 ) // l ) NEW_LINE


x , y , a , b = map ( int , input ( ) . split ( ) ) u = 0 import math     f = math . gcd ( x , y ) lcm = x * y // f   print ( b // lcm - ( a - 1 ) // lcm ) NEW_LINE


from math import gcda , b , c , d = map ( int , input ( ) . split ( ) ) lcmm = ( a * b ) // gcd ( a , b ) div_c = ( d // lcmm ) - ( ( c - 1 ) // lcmm ) print ( div_c ) NEW_LINE


import math   x , y , a , b = map ( int , input ( ) . split ( ) ) l = max ( x , y ) * min ( x , y ) // math . gcd ( x , y ) print ( b // l - ( a - 1 ) // l ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { int x , y , a , b , min , max , sum = 0 , fir , lir ; Scanner scanner = new Scanner ( System . in ) ; x = scanner . nextInt ( ) ; y = scanner . nextInt ( ) ; a = scanner . nextInt ( ) ; b = scanner . nextInt ( ) ; min = Math . min ( x , y ) ; max = Math . max ( x , y ) ; int limit = b ; int common = max ; int temp = common / min ; while ( temp * min != common && common <= b ) { common += max ; temp = common / min ; } temp = ( ( int ) ( a / common ) * common ) ; fir = ( temp >= a ) ? temp : temp + common ; temp = ( ( int ) ( b / common ) * common ) ; while ( temp <= b ) { temp += common ; } lir = temp - common ; System . out . print ( ( ( lir - fir ) / common ) + 1 ) ;   } }


import java . util . * ; import java . lang . * ;


import java . util . * ; public class Third {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; String s1 = sc . next ( ) ; String s2 = sc . next ( ) ; String s3 = sc . next ( ) ; int a1 = beauty ( s1 , n ) ; int a2 = beauty ( s2 , n ) ; int a3 = beauty ( s3 , n ) ; if ( a1 > a2 && a1 > a3 ) System . out . println ( " Kuro " ) ; else if ( a2 > a1 && a2 > a3 ) System . out . println ( " Shiro " ) ; else if ( a3 > a1 && a3 > a2 ) System . out . println ( " Katie " ) ; else System . out . println ( " Draw " ) ; }   static int beauty ( String s , int n ) { int cnt [ ] = new int [ 128 ] ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; cnt [ c ] ++ ; } for ( char c = ' a ' ; c <= ' z ' ; c ++ ) { if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ; else { cnt [ c ] += n ; cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ; } } for ( char c = ' A ' ; c <= ' Z ' ; c ++ ) { if ( cnt [ c ] == s . length ( ) && n == 1 ) cnt [ c ] -- ; else { cnt [ c ] += n ; cnt [ c ] = Math . min ( s . length ( ) , cnt [ c ] ) ; } } int max = 0 ; for ( int i = 0 ; i < 128 ; i ++ ) { max = Math . max ( max , cnt [ i ] ) ; } return max ; } }

n = int ( input ( ) ) black = list ( input ( ) ) white = list ( input ( ) ) katie = list ( input ( ) )   ALPHABET = [ chr ( i ) for i in range ( 65 , 65 + 26 ) ] + [ chr ( i ) for i in range ( 97 , 97 + 26 ) ]     def optimal_score ( LIST ) : d = { char : 0 for char in ALPHABET } for v in LIST : d [ v ] += 1 max_freq = max ( d . values ( ) ) L = len ( LIST ) res = 0 for freq in d . values ( ) : if L - freq >= n : res = max ( res , freq + n ) else : if not ( L - freq < n and n == 1 ) : res = L else : res = max ( res , L - 1 ) return res     score_black = optimal_score ( black ) score_white = optimal_score ( white ) score_katie = optimal_score ( katie )   M = max ( score_black , score_katie , score_white ) MAXCNT = 0   winner = " NOBODY "     if M == score_black : winner = " Kuro " MAXCNT += 1 if M == score_white : winner = " Shiro " MAXCNT += 1 if M == score_katie : winner = " Katie " MAXCNT += 1   if MAXCNT == 1 : print ( winner )   else : print ( " Draw " ) NEW_LINE


n = int ( input ( ) )   kuroo = input ( ) shiro = input ( ) katie = input ( )   kuroo_dict = { } shiro_dict = { } katie_dict = { }   def cal ( d , str , n ) :   for i in range ( len ( str ) ) : if str [ i ] in d : d [ str [ i ] ] += 1 else : d [ str [ i ] ] = 1   m = 0 for key in d : m = max ( m , d [ key ] )   if ( n == 1 and m == len ( str ) ) : m = len ( str ) - 1 else : m = min ( m + n , len ( str ) )     return m         ans_kuroo = cal ( kuroo_dict , kuroo , n ) ans_shiro = cal ( shiro_dict , shiro , n ) ans_katie = cal ( katie_dict , katie , n ) ans = max ( ans_kuroo , ans_shiro , ans_katie )   if ( ans_kuroo == ans_katie and ans_kuroo == ans ) or ( ans_katie == ans_shiro and ans_shiro == ans ) or ( ans_shiro == ans_kuroo and ans_kuroo == ans ) : print ( " Draw " ) else : if ans == ans_kuroo : print ( " Kuro " ) elif ans == ans_shiro : print ( " Shiro " ) else : print ( " Katie " )           NEW_LINE


n = int ( input ( ) ) se = [ ] def fun ( kuro ) : global se le = len ( kuro ) dic = { } for i in kuro : if ( i in dic ) : dic [ i ] += 1 else : dic [ i ] = 1 a1 = 1 for i in dic : ma = dic [ i ] rest = le - ma if ( rest >= n ) : a1 = max ( ma + n , a1 ) elif ( n != 1 ) : a1 = max ( ma + rest , a1 ) else : if ( rest == 0 ) : a1 = max ( a1 , ma - 1 ) else : a1 = max ( a1 , ma + 1 ) se . append ( a1 ) for i in range ( 3 ) : fun ( input ( ) ) ma = max ( se ) if ( se . count ( ma ) != 1 ) : print ( ' Draw ' ) else : if ( se [ 0 ] == ma ) : print ( ' Kuro ' ) elif ( se [ 1 ] == ma ) : print ( ' Shiro ' ) else : print ( ' Katie ' ) NEW_LINE


import java . io . BufferedReader ; import java . io . * ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . math . * ; 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 [ ] ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = 1 ;


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Fridge { public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int T = sc . nextInt ( ) ; while ( T -- > 0 ) { int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; List < Integer > grt = new ArrayList < Integer > ( ) ; List < Integer > sml = new ArrayList < Integer > ( ) ; long sum = 0 , cur = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; if ( ar [ i ] >= x ) grt . add ( ar [ i ] ) ; else sml . add ( ar [ i ] ) ; sum += ar [ i ] ; } Collections . sort ( sml ) ; Collections . sort ( grt ) ; int i = 0 ; int div = n ; while ( i < n ) {

t = int ( input ( ) ) u = [ ] for i in range ( t ) : z = list ( map ( int , input ( ) . split ( ) ) ) y = list ( map ( int , input ( ) . split ( ) ) ) x = z [ 1 ] n = z [ 0 ] e = [ ] c = [ ] b = [ ] for j in range ( len ( y ) ) : if y [ j ] >= x : e . append ( y [ j ] - x ) else : c . append ( x - y [ j ] ) b . append ( y [ j ] ) es = sum ( e ) c . sort ( ) b . sort ( ) k = 0 p = 0 NEW_LINE


t = int ( input ( ) )   while t > 0 : t -= 1 n , x = map ( int , input ( ) . split ( ' ▁ ' ) ) A = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) A . sort ( reverse = True )   c = 0 temp = 0 for i in range ( n ) : if temp + A [ i ] >= ( i + 1 ) * x : temp += A [ i ] c += 1 else : break print ( c ) NEW_LINE


for i in range ( int ( input ( ) ) ) : a , b = [ int ( i ) for i in input ( ) . split ( ) ] l = [ int ( i ) for i in input ( ) . split ( ) ] l . sort ( reverse = True ) count = 0 sumi = 0 for i in range ( a ) : if l [ i ] < b : k = b - l [ i ] if sumi >= k : count += 1 sumi -= k else : count += 1 sumi += ( l [ i ] - b ) print ( count ) NEW_LINE


n = int ( input ( ) ) for i in range ( n ) : a , b = [ int ( i ) for i in input ( ) . split ( ) ] s = [ int ( i ) for i in input ( ) . split ( ) ] s . sort ( ) total = sum ( s ) j = 0 while a > 0 and total // a < b : a -= 1 total -= s [ j ] j += 1 print ( a ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n , x = map ( int , input ( ) . split ( ) ) m = list ( map ( int , input ( ) . split ( ) ) ) m . sort ( ) s = sum ( m ) num = n for i in range ( n ) : if x <= s / num : break s = s - m [ i ] num -= 1 print ( num )                                                                                NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int al = scanner . nextInt ( ) ; int ar = scanner . nextInt ( ) ; int bl = scanner . nextInt ( ) ; int br = scanner . nextInt ( ) ; if ( br >= al - 1 && br <= 2 * ( al + 1 ) && al != 0 ) { System . out . println ( " YES " ) ; return ; } else if ( bl >= ar - 1 && bl <= 2 * ( ar + 1 ) && ar != 0 ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; } } }

def fingers ( a , b ) : if NEW_LINE b + 1 >= a and 2 * a + 2 >= b : NEW_LINE return True   a , a1 = map ( int , input ( ) . split ( ) ) NEW_LINE b , b1 = map ( int , input ( ) . split ( ) ) NEW_LINE if fingers ( a , b1 ) or fingers ( a1 , b ) == True : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT


from math import ceil   ai , ar = map ( int , input ( ) . split ( ) ) NEW_LINE bi , br = map ( int , input ( ) . split ( ) )   if ( ceil ( bi / 2 ) - 1 <= ar and not bi + 1 < ar ) or ( ceil ( br / 2 ) - 1 <= ai and not br + 1 < ai ) : NEW_LINE INDENT print ( ' YES ' ) else : NEW_LINE print ( ' NO ' ) NEW_LINE DEDENT


gf = input ( ) . split ( ) NEW_LINE bf = input ( ) . split ( )   al , ar = int ( gf [ 0 ] ) , int ( gf [ 1 ] ) NEW_LINE bl , br = int ( bf [ 0 ] ) , int ( bf [ 1 ] )   if ar - 1 <= bl <= 2 * ar + 2 or al - 1 <= br <= 2 * al + 2 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT


import matha = input ( ) NEW_LINE a = a . split ( ) NEW_LINE a = [ int ( i ) for i in a ] NEW_LINE b = input ( ) NEW_LINE b = b . split ( ) NEW_LINE b = [ int ( i ) for i in b ] NEW_LINE if ( a [ 0 ] <= b [ 1 ] + 1 ) and ( math . floor ( ( b [ 1 ] + 1 ) / 2 ) - 1 <= a [ 0 ] ) : NEW_LINE INDENT print ( ' YES ' ) elif ( a [ 1 ] <= b [ 0 ] + 1 ) and ( math . floor ( ( b [ 0 ] + 1 ) / 2 ) - 1 <= a [ 1 ] ) : NEW_LINE print ( ' YES ' ) else : NEW_LINE print ( ' NO ' )   NEW_LINE DEDENT


al , ar = map ( int , input ( ) . split ( ) ) NEW_LINE bl , br = map ( int , input ( ) . split ( ) ) NEW_LINE if 2 * ( al + 1 ) >= br >= al - 1 or 2 * ( ar + 1 ) >= bl >= ar - 1 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT


import java . util . * ; import java . io . * ;   public class Tournament { public static void main ( String [ ] args ) throws IOException { BufferedReader brs = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   int t = 1 ;   while ( t -- > 0 ) { String str [ ] = brs . readLine ( ) . trim ( ) . split ( " ▁ " ) ; int gl = Integer . parseInt ( str [ 0 ] ) ; int gr = Integer . parseInt ( str [ 1 ] ) ; str = brs . readLine ( ) . trim ( ) . split ( " ▁ " ) ; int bl = Integer . parseInt ( str [ 0 ] ) ; int br = Integer . parseInt ( str [ 1 ] ) ; if ( check ( gl , br ) || check ( gr , bl ) ) pw . println ( " YES " ) ; else pw . println ( " NO " ) ; } pw . flush ( ) ; }   public static boolean check ( int g , int b ) { if ( b < g - 1 ) return false ;   b = b - 2 * ( g - 1 ) ; int x = b / 2 ; b -= x ;   if ( b < 3 && x < 3 ) return true ; else return false ; } }


import java . io . * ; import java . util . * ; import java . math . * ; import java . math . BigInteger ;    public final class A { static StringBuilder ans = new StringBuilder ( ) ; static FastReader in = new FastReader ( ) ; static ArrayList < ArrayList < Integer > > g , tg ; static long mod = 998244353 ; static boolean set [ ] , col [ ] ; static int D [ ] , par [ ] ; static pair size [ ] , size1 [ ] ; static char G [ ] [ ] ; static int dp [ ] [ ] ;

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) temp = max ( a ) if len ( set ( a ) ) == 1 and a [ 0 ] == 1 : print ( * a [ : - 1 ] , 2 ) else : a [ a . index ( temp ) ] = 1 a . sort ( ) print ( * a ) NEW_LINE


a = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) z = max ( b ) if z == 1 : b [ b . index ( z ) ] = 2 else : b [ b . index ( z ) ] = 1 print ( * sorted ( b ) ) NEW_LINE


import sysfrom functools import lru_cache , cmp_to_keyfrom heapq import merge , heapify , heappop , heappush NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class Main   { static FastReader sc = new FastReader ( ) ; static int dp [ ] [ ] ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; }   public static void main ( String [ ] args ) throws IOException { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; int max = Integer . MIN_VALUE ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = input . nextInt ( ) ; max = Math . max ( max , a [ i ] ) ; }


import java . util . * ; import java . lang . * ; import java . io . * ;   public class GFG { 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 ( ) ) ; } } public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ;     int size = sc . nextInt ( ) ; long a [ ] = new long [ size ] ; int c = 0 ; for ( int u = 0 ; u < size ; u ++ ) { a [ u ] = sc . nextLong ( ) ; if ( a [ u ] != 1 ) { c ++ ; } } Arrays . sort ( a ) ; if ( c != 0 ) { System . out . print ( "1 ▁ " ) ; for ( int u = 0 ; u < size - 1 ; u ++ ) { System . out . print ( a [ u ] + " ▁ " ) ; } } if ( c == 0 ) { for ( int u = 0 ; u < size - 1 ; u ++ ) { System . out . print ( a [ u ] + " ▁ " ) ; } System . out . print ( "2 ▁ " ) ; }   System . out . println ( ) ; } }


# include < bits / stdc ++ . h > using namespace std ; int a [ 100001 ] ; int main ( ) { int n ; cin >> n ; for ( int i = 0 ; i < n ; i ++ ) { cin >> a [ i ] ; } sort ( a , a + n ) ; if ( a [ n - 1 ] == 1 ) { a [ n - 1 ] = 2 ; } else { a [ n - 1 ] = 1 ; sort ( a , a + n ) ; } sort ( a , a + n ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { cout << a [ i ] << " ▁ " ; } cout << a [ n - 1 ] ; }


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; if ( n % 2 == 0 ) { if ( k <= n / 3 && k != 0 ) { System . out . println ( 1 + " ▁ " + 2 * k ) ; } else { if ( k == 0 || k == n ) { System . out . println ( 0 + " ▁ " + 0 ) ; } else { System . out . println ( 1 + " ▁ " + ( n - k ) ) ; } } } else { if ( k <= ( n / 3 ) ) { if ( k == 0 ) { System . out . println ( 0 + " ▁ " + 0 ) ; } else { System . out . println ( 1 + " ▁ " + 2 * k ) ;   } } else { if ( k == n ) { System . out . println ( 0 + " ▁ " + 0 ) ; } else { System . out . println ( 1 + " ▁ " + ( n - k ) ) ; } } }   } }

import mathinp = input ( ) n , k = inp . split ( ) n = int ( n ) k = int ( k ) minn = 1 if ( n - k == 0 ) or ( k == 0 ) : minn = 0 maxx = 0   maxx = k * 2 if ( n - maxx - k < 0 ) : maxx = n - k     print ( minn , end = " ▁ " ) print ( maxx ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) if n == k or k == 0 : print ( 0 , 0 ) else : print ( 1 , min ( n - k , 2 * k ) ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) if k == n or k == 0 : print ( 0 , 0 ) elif k <= ( n ) // 3 : print ( 1 , k * 2 ) else : print ( 1 , n - k ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) print ( min ( k , 1 , 1 - ( k == n ) ) , min ( k * 2 , n - k ) ) NEW_LINE


n , k = input ( ) . split ( ) n = int ( n ) k = int ( k ) if ( k >= n or k == 0 ) : min1 = 0 max1 = 0 else : min1 = 1 if ( k * 3 <= n ) : max1 = k * 2 else : x = k * 3 - n max1 = k * 2 - xprint ( min1 , end = " ▁ " ) print ( max1 ) NEW_LINE


import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;