import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class BearAndFindingCriminals { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; int n = fs . nextInt ( ) ; int location = fs . nextInt ( ) ; boolean [ ] cities = new boolean [ n ] ; int criminals = 0 ; for ( int i = 0 ; i < n ; i ++ ) { cities [ i ] = fs . nextInt ( ) == 1 ; } if ( n == 1 ) { System . out . println ( cities [ 0 ] ? 1 : 0 ) ; return ; } if ( cities [ location - 1 ] ) { criminals ++ ; } int left = location - 2 ; int right = location ; while ( true ) { if ( left >= 0 && right < n ) { if ( cities [ left ] && cities [ right ] ) { criminals += 2 ; } left -- ; right ++ ; } else if ( left == - 1 && right < n ) { criminals += cities [ right ++ ] ? 1 : 0 ; } else if ( left >= 0 && right == n ) { criminals += cities [ left -- ] ? 1 : 0 ; } else { break ; } } System . out . println ( criminals ) ; }   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 ; } } }

import sys   n , a = map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) t = list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) a = a - 1   res = 0 for i in range ( len ( t ) ) : if ( a - i ) >= 0 and ( a + i ) < len ( t ) : res += ( 1 if i == 0 else 2 ) * ( t [ a - i ] * t [ a + i ] ) elif not ( ( a - i ) >= 0 or ( a + i ) < len ( t ) ) : break elif ( a - i ) < 0 : res += t [ a + i ] else : res += t [ a - i ] print ( res )   NEW_LINE


n , a = map ( int , input ( ) . split ( ) ) criminals = [ int ( i ) for i in input ( ) . split ( ) ] if ( n == 1 or n == 2 ) : print ( criminals . count ( 1 ) ) else : if ( a - 1 < n - a ) : x = a - 1 c1 = criminals [ : 2 * a - 1 ] c2 = criminals [ 2 * a - 1 : ] else : x = n - a c2 = criminals [ : n - 2 * ( n - a ) - 1 ] c1 = criminals [ n - 2 * ( n - a ) - 1 : ] NEW_LINE


n , a = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) )   c = 0 if ( l [ a - 1 ] == 1 ) : c = c + 1 if ( len ( l ) == 1 ) : print ( c ) exit ( ) i = 0j = nwhile True : if ( abs ( j - a ) > abs ( a - i - 1 ) ) : if ( l [ j - 1 ] == 1 ) : c = c + 1 j = j - 1 elif ( abs ( j - a ) < abs ( a - i - 1 ) ) : if ( l [ i ] == 1 ) : c = c + 1 i = i + 1 elif ( abs ( j - a ) == abs ( a - i - 1 ) ) : if ( l [ i ] == 1 and l [ j - 1 ] == 1 or l [ j - 1 ] == 1 and l [ i ] == 1 ) : c = c + 2 i += 1 j -= 1   if ( i == a - 1 and j == a ) : breakprint ( c ) NEW_LINE


import pdb   def solve ( ) : m , n = map ( int , input ( ) . split ( ) ) criminals = list ( map ( int , input ( ) . split ( ) ) ) l = n - 1 r = n - 1 acc = 0 while l >= 0 or r < len ( criminals ) : if l == r : acc += criminals [ l ] else : if l >= 0 and r < len ( criminals ) : if criminals [ l ] == criminals [ r ] : acc += 2 * criminals [ l ] elif l >= 0 : acc += criminals [ l ] elif r < len ( criminals ) : acc += criminals [ r ] l -= 1 r += 1 print ( acc )   if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE


import java . util . * ;    public class Practise {


import java . util . Arrays ; import java . util . Locale ; import java . util . Scanner ; import java . lang . String ; import java . util . Random ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int l = sc . nextInt ( ) ; int m = sc . nextInt ( ) - 1 ; int mas [ ] = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { mas [ i ] = sc . nextInt ( ) ; } int ans = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( mas [ i ] == 1 ) { if ( Math . abs ( i - m ) == 0 || 2 * m - i < 0 || 2 * m - i >= l || mas [ 2 * m - i ] == 1 ) { ans ++ ; } } } System . out . println ( ans ) ; } }


import java . util . * ; import java . util . stream . IntStream ;   public class twonos {   public static void main ( String [ ] args ) {

x = int ( input ( ) ) a = b = xif a * b > x : print ( a , b ) else : print ( - 1 ) NEW_LINE


import sys   def main ( ) : n = int ( sys . stdin . read ( ) . strip ( ) ) return n != 1 and ( n , n ) or ( - 1 , ) print ( * main ( ) ) NEW_LINE


x = int ( input ( ) )   flag = Falsefor a in range ( 1 , x + 1 ) : for b in range ( 1 , x + 1 ) : if a % b == 0 and a * b > x and a / b < x : flag = True break if flag : breakif not flag : print ( ' - 1' ) if flag : print ( a , b ) NEW_LINE


n = int ( input ( ) ) l = [ ] for a in range ( 1 , n + 1 ) : for b in range ( 1 , n + 1 ) : if a % b == 0 and a * b > n and a / b < n : l . append ( a ) l . append ( b ) if len ( l ) > 0 : print ( l [ 0 ] , l [ 1 ] ) else : print ( - 1 )                           NEW_LINE


def main_function ( ) : x = int ( input ( ) ) for a in range ( 1 , x + 1 ) : i = 1 while i * a <= x : if i * a ** 2 > x and i < x : return f " { i ▁ * ▁ a } ▁ { a } " i += 1 return " - 1"         print ( main_function ( ) ) NEW_LINE


import java . util . Scanner ;   public class Race3 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int x = in . nextInt ( ) ; for ( int i = 1 ; i <= x ; i ++ ) { for ( int j = 1 ; j <= x ; j ++ ) { if ( i % j == 0 && i * j > x && i / j < x ) { System . out . println ( i + " ▁ " + j ) ; System . exit ( 0 ) ; } } } System . out . println ( - 1 ) ; } }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = n , b = 1 , c = 0 ; while ( a >= b ) { if ( a % b == 0 ) { if ( a * b > n ) { if ( a / b < n ) { c ++ ; break ; } } else { b ++ ; } } else { a -- ; } } if ( c > 0 ) { System . out . println ( a + " ▁ " + b ) ; } else { System . out . println ( " - 1" ) ; } } }


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { int x ; Boolean exsit = false ; Scanner input = new Scanner ( System . in ) ; x = input . nextInt ( ) ; for ( int a = 1 ; a <= x ; a ++ ) { for ( int b = 1 ; a % b == 0 ; b ++ ) { if ( a * b > x && a / b < x ) { System . out . println ( a + " ▁ " + b ) ; exsit = true ; break ; } } if ( exsit ) break ; } if ( ! exsit ) System . out . println ( - 1 ) ; } }


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 ( ) ; if ( n == 1 ) System . out . println ( - 1 ) ; else if ( n == 2 | n == 3 ) System . out . println ( 2 + " ▁ " + 2 ) ; else if ( n > 3 ) { if ( ( n & 1 ) == 0 ) System . out . println ( n + " ▁ " + 2 ) ; if ( ( n & 1 ) == 1 ) System . out . println ( n - 1 + " ▁ " + 2 ) ; } } }


import java . util . * ; import java . io . * ; import java . math . * ;   public class x430A { public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; int M = Integer . parseInt ( st . nextToken ( ) ) ; Pair [ ] arr = new Pair [ N ] ; st = new StringTokenizer ( infile . readLine ( ) ) ; for ( int i = 0 ; i < N ; i ++ ) arr [ i ] = new Pair ( Integer . parseInt ( st . nextToken ( ) ) , i ) ; Arrays . sort ( arr ) ; int tag = 0 ; int [ ] res = new int [ N ] ; for ( Pair p : arr ) { res [ p . dex ] = tag ; tag = 1 - tag ; } for ( int x : res ) System . out . print ( x + " ▁ " ) ; } } class Pair implements Comparable < Pair > { int val ; int dex ; public Pair ( int a , int b ) { val = a ; dex = b ; } public int compareTo ( Pair oth ) { return val - oth . val ; } }

from sys import stdin , stdoutnmbr = lambda : int ( stdin . readline ( ) ) lst = lambda : list ( map ( int , stdin . readline ( ) . split ( ) ) ) for _ in range ( 1 ) : NEW_LINE


n , m = [ int ( i ) for i in input ( ) . split ( ) ] p = list ( map ( int , input ( ) . split ( ) ) ) s = [ input ( ) . split ( ) for _ in range ( m ) ] ps , result = sorted ( p ) , [ - 1 ] * nfor i in range ( n ) : if i % 2 == 0 : c = 1 else : c = 0 result [ p . index ( ps [ i ] ) ] = cprint ( * result ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : arr [ i ] = ( arr [ i ] , i ) arr . sort ( ) res = [ 0 ] * nfor i in range ( n ) : res [ arr [ i ] [ 1 ] ] = i % 2 print ( * res ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) X = [ int ( x ) for x in input ( ) . split ( ) ] segs = [ [ int ( x ) for x in input ( ) . split ( ) ] for _ in range ( m ) ]   D = { e : i % 2 for i , e in enumerate ( sorted ( X ) ) }   for i in range ( n ) : X [ i ] = D [ X [ i ] ] print ( * X ) NEW_LINE


import java . io . BufferedReader ; import java . io . FileReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ; import java . io . * ; public class codeforces { static class Student { int x , y ; Student ( int x , int y ) { this . x = x ; this . y = y ;


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static int oo = ( int ) 1e7 ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . stream . Collectors ;   public class CF1385B { public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int [ ] hash = new int [ n + 1 ] ; int [ ] a = Arrays . stream ( br . readLine ( ) . split ( " \\ s + " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; List < Integer > perm = new ArrayList < > ( ) ; for ( final int value : a ) { if ( hash [ value ] == 0 ) { perm . add ( value ) ; hash [ value ] = 1 ; } } System . out . println ( perm . stream ( ) . map ( String :: valueOf ) . collect ( Collectors . joining ( " ▁ " ) ) ) ; } } }

for _ in range ( int ( input ( ) ) ) : input ( ) ; print ( * set ( map ( int , input ( ) . split ( ) ) ) ) NEW_LINE


t = int ( input ( ) ) answer = [ ] for i in range ( t ) : n = int ( input ( ) ) li = [ int ( j ) for j in input ( ) . split ( ) ] ans = [ ] for item in li : if item not in ans : ans . append ( item ) answer . append ( ans )     for x in answer : print ( * x ) NEW_LINE


for s in [ * open ( 0 ) ] [ 2 : : 2 ] : a = list ( map ( int , s . split ( ) ) ) ans = [ ] ; used = set ( ) for n in a : if n in used : continue ans . append ( n ) ; used . add ( n ) print ( * ans ) NEW_LINE


for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = [ ] for i in a : if i not in b : b . append ( i ) print ( * b , sep = " ▁ " ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : a = int ( input ( ) ) x = list ( map ( int , input ( ) . split ( ) ) ) u = [ ] for k in x : if k not in u : u . append ( k ) print ( * u ) NEW_LINE


import java . util . * ; public class main { public static void main ( String [ ] args ) { Scanner scn = new Scanner ( System . in ) ; int t = scn . nextInt ( ) ;   while ( t -- > 0 ) { int n = scn . nextInt ( ) ;   int [ ] arr = new int [ 2 * n ] ; HashSet < Integer > hs = new HashSet < > ( ) ;   boolean [ ] mark = new boolean [ n ] ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { arr [ i ] = scn . nextInt ( ) ; if ( ! mark [ arr [ i ] - 1 ] ) { al . add ( arr [ i ] ) ; mark [ arr [ i ] - 1 ] = true ; } }   for ( int i = 0 ; i < n ; i ++ ) System . out . print ( al . get ( i ) + " ▁ " ) ;   System . out . println ( ) ; } } }


import static java . lang . Math . abs ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Codeforces {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; ArrayList < String > all_val = new ArrayList < > ( ) ; int big_loop = sc . nextInt ( ) ; for ( int loop = 0 ; loop < big_loop ; loop ++ ) { int num = sc . nextInt ( ) * 2 ; ArrayList < String > input = new ArrayList < > ( ) ; String ans = " " ; for ( int i = 0 ; i < num ; i ++ ) { String val = sc . nextInt ( ) + " " ; if ( input . contains ( val ) ) { ans += val + " ▁ " ; } else { input . add ( val ) ; } } all_val . add ( ans ) ; } for ( String an : all_val ) { System . out . println ( an ) ; } } }


import java . util . LinkedHashSet ; import java . util . Scanner ;   public class B1383 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int t = scanner . nextInt ( ) ; LinkedHashSet < Integer > set = new LinkedHashSet < > ( ) ;   for ( int i = 0 ; i < t ; i ++ ) { int n = scanner . nextInt ( ) ; for ( int j = 0 ; j < 2 * n ; j ++ ) { int b = scanner . nextInt ( ) ; set . add ( b ) ; } for ( Integer integer : set ) { System . out . print ( integer + " ▁ " ) ; } set . clear ( ) ; System . out . println ( ) ; } } }


import java . io . * ; import java . util . * ; public class Main { public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; while ( t -- > 0 ) { int n = Integer . parseInt ( br . readLine ( ) ) ; int arr [ ] = new int [ n * 2 ] ; String s [ ] = br . readLine ( ) . split ( " ▁ " ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) arr [ i ] = Integer . parseInt ( s [ i ] ) ; HashSet < Integer > hs = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { if ( ! hs . contains ( arr [ i ] ) ) { System . out . print ( arr [ i ] + " ▁ " ) ; hs . add ( arr [ i ] ) ; } } System . out . println ( ) ; } } }


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

a = int ( input ( ) ) b = input ( ) c2 = b . count ( '2' ) c1 = b . count ( '1' ) sum = 0 sum += min ( c2 , c1 ) c1 -= c2if c1 > 0 : sum += c1 // 3 print ( sum ) NEW_LINE


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) ris = 0 num2 = arr . count ( 2 ) num1 = arr . count ( 1 ) if num1 >= num2 : ris += num2 num1 -= num2 ris += num1 // 3 elif num1 <= num2 and 1 in arr : ris += num1print ( ris ) NEW_LINE


n = int ( input ( ) ) T = list ( map ( int , input ( ) . split ( ) ) ) one = T . count ( 1 ) two = T . count ( 2 ) if one == 0 or two == 0 : print ( one // 3 ) elif one <= two : print ( one ) else : print ( two + ( one - two ) // 3 ) NEW_LINE


num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ones = sum ( 1 for i in arr if i == 1 ) twos = num - ones   ans = max ( ones // 3 + min ( ones % 3 , twos ) , min ( ones , twos ) + ( ones - min ( ones , twos ) ) // 3 )   print ( ans ) NEW_LINE


n = int ( input ( ) ) nums = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) one = nums . count ( 1 ) two = nums . count ( 2 ) if one == 0 : print ( 0 ) elif two == 0 : print ( one // 3 ) else : discard = max ( one , two ) - min ( one , two ) form = len ( nums ) - discard if discard > 2 and one > two : discard = discard // 3 print ( ( form // 2 ) + discard ) else : print ( form // 2 ) NEW_LINE


import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000899A { static public void main ( final String [ ] args ) throws IOException { p000899A . _main ( args ) ; }


import java . util . * ; import java . lang . * ; import java . io . * ;   public class Problem { public static void main ( String [ ] args ) throws java . lang . Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; String line = br . readLine ( ) ; int [ ] ar = Arrays . stream ( line . split ( " ▁ " ) ) . mapToInt ( Integer :: parseInt ) . toArray ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ar [ i ] == 1 ) one ++ ; else two ++ ; } int sum = 0 ; if ( two == one ) sum += two ; else if ( two < one ) { sum += two ; one -= two ; sum += one / 3 ; } else { sum += one ; } System . out . println ( sum ) ; } }


import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; Scanner sc = new Scanner ( System . in ) ; int n = fr . nextInt ( ) ; int one = 0 , two = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = fr . nextInt ( ) ; if ( x == 1 ) one ++ ; else two ++ ; } if ( one == two ) System . out . print ( two ) ; else if ( one < two ) System . out . print ( one ) ; else { int ans = two ; one -= two ; ans += one / 3 ; System . out . print ( ans ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintStream ;   public class _81B implements Runnable { private BufferedReader in ;   private Object solve ( ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; String s = nextToken ( ) ; for ( int i = 0 , q = 0 , n = s . length ( ) ; i < n ; i ++ ) { char x = s . charAt ( i ) ; switch ( q ) { case 0 : if ( x == ' . ' ) { sb . append ( sb . length ( ) == 0 ? " . . . " : " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( x ) ; q = 4 ; } break ; case 1 : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( " ▁ , " ) ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } break ; case 2 : q = 3 ; break ; case 3 : q = 0 ; break ; case 4 : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x == ' ▁ ' ) { q = 5 ; } else { sb . append ( x ) ; } break ; default : if ( x == ' . ' ) { sb . append ( " ▁ . . . " ) ; q = 2 ; } else if ( x == ' , ' ) { sb . append ( ' , ' ) ; q = 1 ; } else if ( x != ' ▁ ' ) { sb . append ( ' ▁ ' ) . append ( x ) ; q = 4 ; } }   } return sb ; }

a = input ( ) NEW_LINE b = ' ' NEW_LINE c = 0 NEW_LINE n = len ( a ) NEW_LINE d = 0 NEW_LINE e = 0 NEW_LINE for i in range ( n ) : if NEW_LINE a [ i ] == ' . ' : NEW_LINE if c % 3 == 0 and i != 0 and ( e == 0 or b [ - 1 ] != ' ▁ ' ) : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE c += 1 NEW_LINE d = 0 elif a [ i ] == ' , ' : b += a [ i ] NEW_LINE e += 1 NEW_LINE if i != n - 1 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE d = 0 elif a [ i ] != ' ▁ ' : NEW_LINE if d == 2 : b += ' ▁ ' NEW_LINE e += 1 NEW_LINE b += a [ i ] NEW_LINE e += 1 NEW_LINE d = 1 else : if d == 1 : d = 2 NEW_LINE print ( b ) NEW_LINE


from sys import stdin , stdoutfrom NEW_LINE math NEW_LINE import gcd , ceil , sqrtii1 = lambda : int ( stdin . readline ( ) . strip ( ) ) NEW_LINE is1 = lambda : stdin . readline ( ) . strip ( ) NEW_LINE iia = lambda : list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE isa = lambda : stdin . readline ( ) . strip ( ) . split ( ) NEW_LINE mod = 1000000007   s = is1 ( ) NEW_LINE res = " " NEW_LINE for j , i in enumerate ( s ) : if NEW_LINE i == ' , ' : res += " , ▁ " elif i . isdigit ( ) : NEW_LINE if s [ j - 1 ] == " ▁ " and res [ - 1 ] . isdigit ( ) : res += " ▁ " NEW_LINE res += i elif i == " . " : NEW_LINE if len ( res ) > 0 and res [ - 1 ] != " ▁ " and res [ - 1 ] != " . " : res += " ▁ " NEW_LINE if len ( res ) >= 3 and res [ - 1 ] == " . " and res [ - 2 ] == ' . ' and res [ - 3 ] == ' . ' : res += " ▁ " NEW_LINE res += " . " elif i == " ▁ " : NEW_LINE if len ( res ) > 0 and res [ - 1 ] not in "0123456789 ▁ . " : res += " ▁ " NEW_LINE print ( res . strip ( ) ) NEW_LINE


s = input ( ) NEW_LINE ans = ' ▁ ' . join ( s . split ( ) ) NEW_LINE ans = ans . replace ( ' , ▁ ' , ' , ' ) NEW_LINE ans = ans . replace ( ' ▁ , ' , ' , ' ) NEW_LINE ans = ans . replace ( ' , ' , ' , ▁ ' ) NEW_LINE ans = ans . replace ( ' . . . ▁ ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' ▁ . . . ' , ' . . . ' ) NEW_LINE ans = ans . replace ( ' . . . ' , ' ▁ . . . ' ) NEW_LINE if ans [ 0 ] == ' ▁ ' : ans = ans [ : 0 ] + ans [ 1 : ] NEW_LINE if ans [ - 1 ] == ' ▁ ' : ans = ans [ : - 1 ] NEW_LINE print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ;   public class B implements Runnable {   private static final boolean ONLINE_JUDGE = System . getProperty ( " ONLINE _ JUDGE " ) != null ;   private BufferedReader in ; private PrintWriter out ; private StringTokenizer tok = new StringTokenizer ( " " ) ;   private void init ( ) throws FileNotFoundException { Locale . setDefault ( Locale . US ) ; String fileName = " " ; if ( ONLINE_JUDGE && fileName . isEmpty ( ) ) { in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; out = new PrintWriter ( System . out ) ; } else { if ( fileName . isEmpty ( ) ) { in = new BufferedReader ( new FileReader ( " input . txt " ) ) ; out = new PrintWriter ( " output . txt " ) ; } else { in = new BufferedReader ( new FileReader ( fileName + " . in " ) ) ; out = new PrintWriter ( fileName + " . out " ) ; } } }   String readString ( ) { while ( ! tok . hasMoreTokens ( ) ) { try { tok = new StringTokenizer ( in . readLine ( ) ) ; } catch ( Exception e ) { return null ; } } return tok . nextToken ( ) ; }   int readInt ( ) { return Integer . parseInt ( readString ( ) ) ; }   long readLong ( ) { return Long . parseLong ( readString ( ) ) ; }   double readDouble ( ) { return Double . parseDouble ( readString ( ) ) ; }   int [ ] readIntArray ( int size ) { int [ ] a = new int [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { a [ i ] = readInt ( ) ; } return a ; }   public static void main ( String [ ] args ) {


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { public void solve ( int testNumber , Scanner in , PrintWriter out ) { String s = in . nextLine ( ) ;   s = s . replaceAll ( " ▁ { 2 , } " , " ▁ " )


import java . util . Scanner ; import java . math . * ;   public class Main { static long mul [ ] = new long [ 100010 ] ; static long res = 0 ; static long ans = 0 ;   static void dfs ( long x , int len , long s ) { if ( x <= 7 ) { if ( res < len + x ) { res = len + x ; ans = s + x ; } else if ( res == len + x && ans < s + x ) ans = s + x ; return ; } int lb = 1 , ub = 100000 ; int ans = 1 ; while ( ub >= lb ) { int mid = ub + lb >> 1 ; if ( mul [ mid ] > x ) { ub = mid - 1 ; } else { lb = mid + 1 ; ans = mid ; } } dfs ( x - mul [ ans ] , len + 1 , s + mul [ ans ] ) ; dfs ( mul [ ans ] - mul [ ans - 1 ] - 1 , len + 1 , s + mul [ ans - 1 ] ) ; }   public static void main ( String args [ ] ) { Scanner cin = new Scanner ( System . in ) ; for ( int i = 1 ; i <= 100000 ; i ++ ) mul [ i ] = ( long ) i * i * i ; long m = cin . nextLong ( ) ; dfs ( m , 0 , 0 ) ; System . out . println ( res + " ▁ " + ans ) ; } }

import math   def steps ( m , dct ) : if m <= 7 : return m if dct . get ( m ) : return dct [ m ] x = math . floor ( m ** ( 1 / 3 ) ) dct [ m ] = 1 + steps ( max ( m - x ** 3 , ( x ** 3 - 1 ) - ( x - 1 ) ** 3 ) , dct ) return dct [ m ]   if __name__ == " _ _ main _ _ " : m = int ( input ( ) ) total_blocks_used = 0 total_vol = 0 steps_dct = { } while ( m > 0 ) : x = math . floor ( m ** ( 1 / 3 ) ) if steps ( m , steps_dct ) == 1 + steps ( m - x ** 3 , steps_dct ) : m -= x ** 3 total_vol += x ** 3 else : m = x ** 3 - 1 - ( x - 1 ) ** 3 total_vol += ( x - 1 ) ** 3 total_blocks_used += 1 print ( f " { total _ blocks _ used } ▁ { total _ vol } " ) NEW_LINE


import math   def root ( m ) : ret = m ** ( 1.0 / 3.0 ) if ( math . ceil ( ret ) ** 3 == m ) : ret = math . ceil ( ret ) else : ret = math . floor ( ret ) return ret   F = { }   def f ( m ) : if ( m < 0 ) : return [ - 1e5 - 10 , - 1e15 - 1 ] if ( m <= 7 ) : return [ m , m ] rootm = root ( m ) ans1 = [ 0 , 0 ] ans2 = [ 0 , 0 ] ans1 = f ( m - rootm ** 3 ) if ( rootm != 1 ) : ans2 = f ( rootm ** 3 - 1 - ( rootm - 1 ) ** 3 ) ; ans2 [ 1 ] += ( rootm - 1 ) ** 3 ; ans2 [ 0 ] += 1 ; ans1 [ 1 ] += rootm ** 3 ; ans1 [ 0 ] += 1 ; if ( ans1 [ 0 ] > ans2 [ 0 ] ) : return ans1 elif ( ans1 [ 0 ] < ans2 [ 0 ] ) : return ans2 else : if ( ans1 [ 1 ] > ans2 [ 1 ] ) : return ans1 else : return ans2   m = int ( input ( ) ) ans = f ( m ) print ( ans [ 0 ] , ans [ 1 ] )   NEW_LINE


def cube ( a ) : return a ** 3     def steps ( m ) : if m <= 7 : return m x = 1 while cube ( x + 1 ) <= m : x += 1 return 1 + steps ( max ( m - cube ( x ) , cube ( x ) - 1 - cube ( x - 1 ) ) )     class CodeforcesTask679BSolution : def __init__ ( self ) : self . result = ' ' self . m = 0   def read_input ( self ) : self . m = int ( input ( ) )   def process_task ( self ) : sub = 0 ste = 0 while self . m : ste += 1 x = 1 while cube ( x + 1 ) <= self . m : x += 1 if steps ( self . m ) == 1 + steps ( self . m - cube ( x ) ) : self . m -= cube ( x ) sub += cube ( x ) else : self . m = cube ( x ) - 1 - cube ( x - 1 ) sub += cube ( x - 1 ) self . result = " { 0 } ▁ { 1 } " . format ( ste , sub )   def get_result ( self ) : return self . result     if __name__ == " _ _ main _ _ " : Solution = CodeforcesTask679BSolution ( ) Solution . read_input ( ) Solution . process_task ( ) print ( Solution . get_result ( ) ) NEW_LINE


B1 = 0 B2 = 0 def solve ( rem , step , sub ) : global B1 , B2 if rem == 0 : if ( step == B1 ) : B2 = max ( B2 , sub ) if ( step > B1 ) : B1 = step B2 = sub return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B1 , B2 ) NEW_LINE


B = ( 0 , 0 ) def solve ( rem , step , sub ) : global B if rem == 0 : B = max ( B , ( step , sub ) ) return cnt = 1 while ( ( cnt + 1 ) ** 3 <= rem ) : cnt += 1 solve ( rem - cnt ** 3 , step + 1 , sub + cnt ** 3 ) if ( cnt > 0 ) : solve ( cnt ** 3 - 1 - ( cnt - 1 ) ** 3 , step + 1 , sub + ( cnt - 1 ) ** 3 )     x = int ( input ( ) ) solve ( x , 0 , 0 ) print ( B [ 0 ] , B [ 1 ] ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static FileWriter fw ; static long oo = Long . MAX_VALUE ;

lst = [ 2 ** i for i in range ( 1 , 34 ) ] s = dict ( ) n = int ( input ( ) ) ss = [ int ( i ) for i in input ( ) . split ( ) ] sss = 0 for i in range ( 0 , n ) : for j in lst : if j - ss [ i ] in s : sss += s [ j - ss [ i ] ] if ss [ i ] in s : s [ ss [ i ] ] += 1 else : s [ ss [ i ] ] = 1 print ( sss ) NEW_LINE


from collections import Counter     def solve ( a ) : res = 0 c = Counter ( a ) for e in a : for p in range ( 31 ) : power = 2 ** p r = power - e if r in c : res += c [ r ] - ( 1 if r == e else 0 ) assert res % 2 == 0 return res // 2     input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( solve ( a ) ) NEW_LINE


from math import log2 , ceildef powerof2 ( k ) : if ( 2 ** ( ceil ( log2 ( k ) ) ) == k ) : return ceil ( log2 ( k ) + 1 ) return ceil ( log2 ( k ) ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in a : try : d [ i ] += 1 except : d [ i ] = 1 c = 0 y = max ( a ) for i in a : r = powerof2 ( i ) for j in range ( r , 33 ) : if ( 2 ** j - i > y ) : break if ( 2 ** j - i == i ) : try : if ( d [ i ] >= 2 ) : NEW_LINE


from math import logfrom collections import defaultdictn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) dic = defaultdict ( lambda : 0 ) ans = 0 for el in a : i = int ( log ( el * 2 , 2 ) ) temp = 2 ** i while temp > 0 : if dic [ temp - el ] != 0 : ans += dic [ temp - el ] temp //= 2 dic [ el ] += 1 print ( ans ) NEW_LINE


import java . io . FileInputStream ; import java . io . InputStream ; import java . util . * ;    public class powersoftwo {   public static void main ( String [ ] args ) throws Exception { FastIO sc = new FastIO ( System . in ) ; int N = sc . nextInt ( ) ; TreeSet < Integer > powersOfTwo = new TreeSet < Integer > ( ) ; int val = 1 ; for ( int i = 0 ; i < 31 ; i ++ ) { powersOfTwo . add ( val ) ; val *= 2 ; } HashMap < Integer , Integer > hmap = new HashMap < Integer , Integer > ( ) ; int [ ] arr = new int [ N ] ; long pairs = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int a = sc . nextInt ( ) ; Iterator < Integer > iter = powersOfTwo . tailSet ( a ) . iterator ( ) ; while ( iter . hasNext ( ) ) { int pow = iter . next ( ) ; if ( hmap . containsKey ( pow - a ) ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class PowersOfTwo { public static TreeMap < Integer , Integer > tm = new TreeMap < > ( ) ;   public static long matches ( int x ) { int ans = 0 ;   int sum = 2 ; for ( int i = 1 ; i <= 30 ; i ++ ) { int y = sum - x ; if ( tm . containsKey ( y ) ) ans += tm . get ( y ) ; sum <<= 1 ; } return ans ; }   public static void addToTreeMap ( int x ) { int freq = 0 ; if ( tm . containsKey ( x ) ) freq = tm . get ( x ) ;   tm . put ( x , freq + 1 ) ; }   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   int n = Integer . parseInt ( br . readLine ( ) ) ;   long ans = 0 ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ;    for ( int i = 0 ; i < n ; i ++ ) { int a = Integer . parseInt ( st . nextToken ( ) ) ; ans += matches ( a ) ; addToTreeMap ( a ) ; }   System . out . println ( ans ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . util . HashMap ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; EPowersOfTwo solver = new EPowersOfTwo ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class EPowersOfTwo { int n ; int [ ] arr ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { readInput ( sc ) ; HashMap < Integer , Integer > map = new HashMap < > ( ) ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 1 ; j < 31 ; j ++ ) { ans += map . getOrDefault ( ( 1 << j ) - arr [ i ] , 0 ) ; } map . put ( arr [ i ] , map . getOrDefault ( arr [ i ] , 0 ) + 1 ) ; } pw . println ( ans ) ; }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . io . * ; import java . util . * ; import java . math . BigInteger ; import java . lang . Object ;    public class Main { static class sort implements Comparator < int [ ] > { public int compare ( int [ ] a , int [ ] b ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ;   public class InnaAndChooseOptions { public static boolean isValid ( String s , int rows , int cols ) { int pointer = 0 ; char [ ] [ ] grid = new char [ rows ] [ cols ] ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) grid [ i ] [ j ] = s . charAt ( pointer ++ ) ; }   for ( int j = 0 ; j < cols ; j ++ ) { boolean allX = true ; for ( int i = 0 ; i < rows ; i ++ ) if ( grid [ i ] [ j ] == ' O ' ) allX = false ; if ( allX ) return true ; } return false ; } public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int t = Integer . parseInt ( br . readLine ( ) ) ; int rows [ ] = { 1 , 2 , 3 , 4 , 6 , 12 } ; int cols [ ] = { 12 , 6 , 4 , 3 , 2 , 1 } ; String ans [ ] = { " ▁ 1x12" , " ▁ 2x6" , " ▁ 3x4" , " ▁ 4x3" , " ▁ 6x2" , " ▁ 12x1" } ; for ( int i = 0 ; i < t ; i ++ ) { String s = br . readLine ( ) ; StringBuilder sb = new StringBuilder ( ) ; int ansCount = 0 ; for ( int j = 0 ; j < 6 ; j ++ ) { if ( isValid ( s , rows [ j ] , cols [ j ] ) ) { ansCount ++ ; sb . append ( ans [ j ] ) ; } }   pw . print ( ansCount ) ; pw . println ( sb ) ; }   pw . flush ( ) ; pw . close ( ) ; } }

def ok ( s , a , b ) : mat = [ ] for i in range ( 0 , len ( s ) , b ) : mat . append ( s [ i : i + b ] )   for j in range ( b ) : c = 0 for i in range ( a ) : if mat [ i ] [ j ] == ' O ' : c += 1 if not c : return True   return False       t = int ( input ( ) ) for _ in range ( t ) : s = input ( ) x = s . count ( ' X ' ) pos = [ [ 1 , 12 ] , [ 2 , 6 ] , [ 3 , 4 ] , [ 4 , 3 ] , [ 6 , 2 ] , [ 12 , 1 ] ]   ans = 0 for i , j in pos : if ( ok ( s , i , j ) ) : ans += 1   print ( ans , end = " ▁ " )   for i , j in pos : if ( ok ( s , i , j ) ) : print ( f " { i } x { j } " , end = " ▁ " )   print ( ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : s = input ( ) lst = [ ] if ' X ' in s : lst . append ( '1x12' ) for i in range ( 6 ) : if s [ i ] == s [ i + 6 ] == ' X ' : lst . append ( '2x6' ) break for i in range ( 4 ) : if s [ i ] == s [ i + 4 ] == s [ i + 8 ] == ' X ' : lst . append ( '3x4' ) break for i in range ( 3 ) : if s [ i ] == s [ i + 3 ] == s [ i + 6 ] == s [ i + 9 ] == ' X ' : lst . append ( '4x3' ) break for i in range ( 2 ) : if s [ i ] == s [ i + 2 ] == s [ i + 4 ] == s [ i + 6 ] == s [ i + 8 ] == s [ i + 10 ] == ' X ' : lst . append ( '6x2' ) break if ' O ' not in s : lst . append ( '12x1' ) print ( len ( lst ) , * lst ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n = input ( ) ab = [ ] if n . find ( ' X ' ) != - 1 : ab . append ( '1x12' ) for i in range ( 0 , 6 ) : if n [ i ] == ' X ' : if n [ 6 + i ] == ' X ' : ab . append ( '2x6' ) break for i in range ( 0 , 4 ) : if n [ i ] == ' X ' and n [ i + 4 ] == ' X ' and n [ i + 8 ] == ' X ' : ab . append ( '3x4' ) break for i in range ( 0 , 3 ) : if n [ i ] == ' X ' and n [ i + 3 ] == ' X ' and n [ i + 6 ] == ' X ' and n [ i + 9 ] == ' X ' : ab . append ( '4x3' ) break if ( n [ 0 ] == ' X ' and n [ 2 ] == ' X ' and n [ 4 ] == ' X ' and n [ 6 ] == ' X ' and n [ 8 ] == ' X ' and n [ 10 ] == ' X ' ) or ( n [ 1 ] == ' X ' and n [ 3 ] == ' X ' and n [ 5 ] == ' X ' and n [ 7 ] == ' X ' and n [ 9 ] == ' X ' and n [ 11 ] == ' X ' ) : ab . append ( '6x2' )   if n . find ( ' XXXXXXXXXXXX ' ) != - 1 : ab . append ( '12x1' ) print ( len ( ab ) , end = ' ▁ ' ) for i in range ( len ( ab ) ) : print ( ab [ i ] , end = ' ▁ ' ) print ( ) NEW_LINE


import mathimport osimport randomimport reimport sysimport functoolsimport datetime as dtfrom operator import itemgetter , attrgetterfrom collections import Counter   if __name__ == ' _ _ main _ _ ' : N = lambda : int ( input ( ) )   t = N ( ) a , r = [ 1 , 2 , 3 , 4 , 6 , 12 ] , list ( )   while t > 0 : s = input ( ) for i in a : for j in range ( 12 // i ) : if s [ j : : 12 // i ] . count ( " X " ) == i : r . append ( " % sx % s " % ( i , 12 // i ) ) break print ( len ( r ) , * r ) r . clear ( ) t -= 1 NEW_LINE


def isMatch ( n , s ) : x = 12 // n res = [ ] for i in range ( 0 , len ( s ) , x ) : res . append ( s [ i : i + x ] ) for col in range ( x ) : for row in range ( len ( res ) ) : if res [ row ] [ col ] != ' X ' : break elif res [ row ] [ col ] == ' X ' and row == len ( res ) - 1 : return True return False   def solve ( s ) : res = [ ] if ' X ' in s : res . append ( "1x12" ) for i in [ 2 , 3 , 4 , 6 ] : if isMatch ( i , s ) : res . append ( f ' { i } x { 12 / / i } ' ) if s == 12 * ' X ' : res . append ( "12x1" ) print ( len ( res ) , sep = " ▁ " , end = " ▁ " ) print ( * res )                 def main ( ) : NEW_LINE


import java . util . Arrays ; import java . util . Scanner ; public class Section { static Scanner sc = new Scanner ( System . in ) ; static int n ; static long m ; static long s = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ;   for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] * m ; if ( m > 1 ) { m -= 1 ; } } System . out . println ( s ) ; } }

inp = input ( ) . split ( ' ▁ ' ) n = int ( inp [ 0 ] ) hrs = int ( inp [ 1 ] ) order = input ( ) . split ( ' ▁ ' ) order = [ int ( x ) for x in order ]   order = sorted ( order ) time = 0 for chapters in order : tps = chapters * hrs if hrs > 1 : hrs -= 1 time += tps   print ( time ) NEW_LINE


import sys     def ints_input ( ) : return [ int ( i ) for i in sys . stdin . readline ( ) . strip ( " \n " ) . split ( " ▁ " ) ]     def print_list ( arr ) : sys . stdout . writelines ( str ( x ) + " ▁ " for x in arr ) sys . stdout . write ( " \n " )     def fast_input ( type = str ) : return type ( sys . stdin . readline ( ) . strip ( " \n " ) )     n , x = ints_input ( ) a = ints_input ( ) a . sort ( ) ans = 0 for i in range ( n ) : ans += a [ i ] * x if x > 1 : x -= 1 print ( ans ) NEW_LINE


n , x = [ int ( j ) for j in input ( ) . split ( ) ] nums = [ int ( j ) for j in input ( ) . split ( ) ] def sort ( l , r ) : size = r - l if size < 2 : return mid = int ( size / 2 + l ) sort ( l , mid ) sort ( mid , r ) decoy , p1 , p2 = [ ] , l , mid while p1 < mid and p2 < r : if nums [ p1 ] < nums [ p2 ] : decoy . append ( nums [ p1 ] ) p1 += 1 else : decoy . append ( nums [ p2 ] ) p2 += 1 while p1 < mid : decoy . append ( nums [ p1 ] ) p1 += 1 while p2 < r : decoy . append ( nums [ p2 ] ) p2 += 1 for j in range ( l , r ) : nums [ j ] = decoy [ j - l ] total = 0 sort ( 0 , n ) for j in range ( n ) : total += nums [ j ] * x x = max ( x - 1 , 1 ) print ( total ) NEW_LINE


import osimport sysfrom io import BytesIO , IOBase BUFSIZE = 8192 class FastIO ( IOBase ) : newlines = 0 def __init__ ( self , file ) : self . _fd = file . fileno ( ) self . buffer = BytesIO ( ) self . writable = " x " in file . mode or " r " not in file . mode self . write = self . buffer . write if self . writable else None def read ( self ) : while True : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) if not b : break ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines = 0 return self . buffer . read ( ) def readline ( self ) : while self . newlines == 0 : b = os . read ( self . _fd , max ( os . fstat ( self . _fd ) . st_size , BUFSIZE ) ) self . newlines = b . count ( b " \n " ) + ( not b ) ptr = self . buffer . tell ( ) self . buffer . seek ( 0 , 2 ) , self . buffer . write ( b ) , self . buffer . seek ( ptr ) self . newlines -= 1 return self . buffer . readline ( ) def flush ( self ) : if self . writable : os . write ( self . _fd , self . buffer . getvalue ( ) ) self . buffer . truncate ( 0 ) , self . buffer . seek ( 0 ) class IOWrapper ( IOBase ) : def __init__ ( self , file ) : self . buffer = FastIO ( file ) self . flush = self . buffer . flush self . writable = self . buffer . writable self . write = lambda s : self . buffer . write ( s . encode ( " ascii " ) ) self . read = lambda : self . buffer . read ( ) . decode ( " ascii " ) self . readline = lambda : self . buffer . readline ( ) . decode ( " ascii " ) sys . stdin , sys . stdout = IOWrapper ( sys . stdin ) , IOWrapper ( sys . stdout ) input = lambda : sys . stdin . readline ( ) . rstrip ( " \n " ) NEW_LINE


n , x = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) t = 0 for i in range ( len ( li ) ) : t += li [ i ] * x if x > 1 : x -= 1 elif x == 0 : x = 1 elif x == 1 : continueprint ( t ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class DevuTheDumbGuy {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; int n = fs . nextInt ( ) ; long x = fs . nextInt ( ) ; Integer [ ] c = fs . nextArray ( n ) ; Arrays . sort ( c ) ; long minTime = 0 ; for ( int i = 0 ; i < n ; i ++ ) { minTime += c [ i ] * x ; if ( x > 1 ) x -- ; } System . out . println ( minTime ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class CF439_D2_B { public static void main ( String [ ] args ) { FastScanner scanner = new FastScanner ( ) ; int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ; Integer [ ] arr = scanner . nextArray ( n ) ; Arrays . sort ( arr ) ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += x * arr [ i ] ; if ( x > 1 ) x -- ; } System . out . println ( sum ) ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( ) { 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 ; }   Integer [ ] nextArray ( int n ) { Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = nextInt ( ) ; } return arr ; } } }


import java . util . Arrays ; import java . util . Scanner ;   public class DumDum { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; long x = scanner . nextInt ( ) ;   Integer [ ] chapters = new Integer [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) chapters [ i ] = scanner . nextInt ( ) ; Arrays . sort ( chapters ) ;   long total = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { total += x * chapters [ i ] ;   if ( x > 1 ) x -- ; }   System . out . println ( total ) ; } }


import java . util . Arrays ; import java . util . Scanner ; public class Section { static Scanner sc = new Scanner ( System . in ) ; static int n ; static long m ; static long s = 0 ; public static void main ( String [ ] args ) { n = sc . nextInt ( ) ; m = sc . nextLong ( ) ; Integer [ ] a = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } Arrays . sort ( a ) ;   for ( int i = 0 ; i < n ; i ++ ) { s += a [ i ] * m ; if ( m > 1 ) { m -= 1 ; } } System . out . println ( s ) ; } }


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; int aa [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { aa [ i ] = sc . nextInt ( ) ; } Arrays . sort ( aa ) ; int cnt = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( aa [ i ] > b && aa [ i ] < c ) { cnt ++ ; } } System . out . println ( cnt ) ; } }

a , b , c = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) s = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] print ( sum ( [ int ( b < x and x < c ) for x in s ] ) ) NEW_LINE


s = input ( ) p = s . split ( ) a = int ( p [ 0 ] ) b = int ( p [ 1 ] ) c = int ( p [ 2 ] ) f = input ( ) ans = [ ] notes = [ int ( i ) for i in input ( ) . split ( ) ] for i in notes : i = int ( i ) if i > b and i < c : ans . append ( i ) print ( len ( ans ) ) NEW_LINE


a , b , c = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] n = int ( input ( ) ) notes = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] answer = len ( [ note for note in notes if b < note < c ] ) print ( answer ) NEW_LINE


s , l , r = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] input ( )   temp = [ 1 for i in input ( ) . split ( " ▁ " ) if l < int ( i ) < r ] print ( sum ( temp ) )   NEW_LINE


a , b , c = map ( int , input ( ) . split ( ) ) num = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ct = 0 for n in arr : if b < n < c : ct += 1   print ( ct ) NEW_LINE


import java . util . Scanner ;   public class A { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int result = 0 , a , b , c ; a = sc . nextInt ( ) ; b = sc . nextInt ( ) ; c = sc . nextInt ( ) ; int n = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; if ( x > b && x < c ) { result ++ ; } } System . out . println ( result ) ;   } }


import java . util . * ; public class CodeForces { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int oleg = input . nextInt ( ) ; int first = input . nextInt ( ) ; int second = input . nextInt ( ) ; int n = input . nextInt ( ) ; int [ ] safes = new int [ n ] ; int count = 0 ; for ( int i = 0 ; i < safes . length ; i ++ ) { safes [ i ] = input . nextInt ( ) ; } Arrays . sort ( safes ) ; for ( int i = 0 ; i < safes . length ; i ++ ) { if ( safes [ i ] > first && safes [ i ] < second ) { count ++ ; } } System . out . println ( count ) ; } }


import java . util . Scanner ;   public class BankRobbery { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; long a = in . nextLong ( ) , b = in . nextLong ( ) , c = in . nextLong ( ) , t = 0 ; int n = in . nextInt ( ) , i ;   for ( i = 0 ; i < n ; i ++ ) { long x = in . nextLong ( ) ; if ( x > b && x < c ) { t ++ ; } } in . close ( ) ; System . out . println ( t ) ; } }


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; in . nextInt ( ) ; int l = in . nextInt ( ) , r = in . nextInt ( ) , n = in . nextInt ( ) , out = 0 ; for ( ; n > 0 ; n -- ) { int x = in . nextInt ( ) ; if ( ( l < x ) && ( x < r ) ) { out ++ ; } } System . out . println ( out ) ; in . close ( ) ; } }


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

sum , limit = map ( int , input ( ) . split ( ) )   ans = [ ] while limit > 0 and sum > 0 : if ( limit & - limit ) <= sum : sum -= ( limit & - limit ) ans . append ( limit ) limit -= 1   if sum > 0 : print ( - 1 ) else : print ( len ( ans ) ) print ( * ans ) NEW_LINE


import mathimport sysimport collectionsimport bisectimport stringdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_list ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) for t in range ( 1 ) : s , l = get_ints ( ) ans = dict ( ) for i in range ( 1 , l + 1 ) : val = i c = 0 while val & 1 != 1 : val >>= 1 c += 1 number = 2 ** c if number not in ans : ans [ number ] = [ i ] else : ans [ number ] . append ( i ) key = list ( ans . keys ( ) ) key . sort ( reverse = True ) sol = [ ] for i in key : val = min ( len ( ans [ i ] ) , s // i ) for j in range ( val ) : sol . append ( ans [ i ] [ j ] ) s -= val * i NEW_LINE


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 java . util . * ; public class TheChildAndSet { static int lowbit ( double x ) { String s = Integer . toBinaryString ( ( int ) x ) ; int i ; for ( i = s . length ( ) - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == '1' ) break ; } return ( int ) Math . pow ( 2 , s . length ( ) - i - 1 ) ; } public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; double sum = sc . nextDouble ( ) ; double limit = sc . nextDouble ( ) ; double temp = Math . min ( sum , limit ) ; ArrayList < Integer > al = new ArrayList < > ( ) ; for ( double i = temp ; i > 1 ; i -- ) { if ( Math . log ( i ) / Math . log ( 2 ) == Math . floor ( Math . log ( i ) / Math . log ( 2 ) ) ) { if ( sum - i >= 0 ) { sum -= i ; al . add ( ( int ) i ) ; } } }


import java . util . Scanner ;   public class Lowbit { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int sum = scanner . nextInt ( ) ; int limit = scanner . nextInt ( ) ;   int count = 0 ; int k = 0 ; StringBuilder ans = new StringBuilder ( ) ;   for ( int i = limit ; i > 0 ; i -- ) { int lowbit = Integer . lowestOneBit ( i ) ;   if ( lowbit + k <= sum ) { count ++ ; k += lowbit ; ans . append ( i ) . append ( " ▁ " ) ; } }   if ( k < sum ) { System . out . println ( - 1 ) ; } else { System . out . println ( count ) ; System . out . println ( ans ) ; } } }


import java . util . * ;    public class Practise {

n , m = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) curr = 0 ans = [ ] for n in arr : curr += n turned = curr // m ans . append ( turned ) curr %= m   print ( * ans ) NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) a = [ int ( item ) for item in input ( ) . split ( ) ] name_remains = 0 for j in range ( n ) : print ( ( name_remains + a [ j ] ) // m , end = " ▁ " ) name_remains = ( name_remains + a [ j ] ) % m NEW_LINE


n , m = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) cur = mans = [ 0 ] * nfor i , a in enumerate ( A ) : if a < cur : cur -= a ans [ i ] = 0 else : q = ( a - cur + m - 1 ) // m r = q * m - ( a - cur ) NEW_LINE


import java . util . * ;   public class CF102 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int [ ] ar = new int [ n ] ; long sum = 0 ; long [ ] count = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; sum = sum + ar [ i ] ; count [ i ] = sum ; } long [ ] ans = new long [ n ] ; ans [ 0 ] = ( count [ 0 ] / m ) ; long sum2 = ans [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans [ i ] = count [ i ] / m - sum2 ; sum2 += ans [ i ] ;   }   for ( Long integer : ans ) { System . out . print ( integer + " ▁ " ) ; } System . out . println ( ) ; }    public static int getAns ( int [ ] ar , int bigger , int i , int [ ] dp ) {   if ( i < 0 ) { return 0 ; } if ( i == 0 ) { return 1 ; } if ( dp [ i ] != - 1 ) { return dp [ i ] ; } int ans1 = 0 , ans2 ; if ( ar [ i ] < bigger ) { ans1 = 1 + getAns ( ar , ar [ i ] , i - 1 , dp ) ;


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; Scanner in = new Scanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; ADeathNote solver = new ADeathNote ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class ADeathNote { int n ; int m ;   public void readInput ( Scanner sc ) { n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; }   public void solve ( int testNumber , Scanner sc , PrintWriter pw ) { int q = 1 ; while ( q -- > 0 ) { readInput ( sc ) ; long prev = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; pw . print ( sum / m - prev + " ▁ " ) ; prev += sum / m - prev ; } } }   }   static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) { try { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class A { public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ;   int n = fs . nextInt ( ) ; int ans = 0 ; int b = n ; int sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } int to = ( 4 - sum % 4 ) % 4 ; if ( to == 0 ) ans = n ; else if ( to + n % 10 <= 9 ) ans = n + to ; else { ans = ( n / 10 + 1 ) * 10 ; b = ans ; sum = 0 ; while ( b > 0 ) { sum += b % 10 ; b /= 10 ; } to = ( 4 - sum % 4 ) % 4 ; ans = ans + to ; } 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 ( ) ) ; } 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 ( ) ) ; } } }

n = int ( input ( ) ) s = str ( n ) sum = 1 while ( sum % 4 != 0 ) : s = str ( n ) sum = 0 for i in s : sum += int ( i ) n += 1 print ( n - 1 ) NEW_LINE


n = int ( input ( ) ) while sum ( [ int ( x ) for x in str ( n ) ] ) % 4 != 0 : n += 1 print ( n ) NEW_LINE


m = int ( input ( ) ) while sum ( [ int ( m ) for m in str ( m ) ] ) % 4 != 0 : m = m + 1 print ( m ) NEW_LINE


n = int ( input ( ) )   while True : if sum ( map ( int , list ( str ( n ) ) ) ) % 4 == 0 : rep = n break else : n += 1 print ( rep ) NEW_LINE


def string_to_list ( s , char ) : collector = " " output_list = [ ] for i in range ( len ( s ) ) : if s [ i ] != char : collector += s [ i ] if i == len ( s ) - 1 : output_list . append ( int ( collector ) ) else : output_list . append ( int ( collector ) ) collector = " " return output_list     def list_to_string ( l , char ) : output_string = " " for i in range ( len ( l ) - 1 ) : output_string += str ( l [ i ] ) + char output_string += str ( l [ - 1 ] ) return output_string     def merge_sort ( l ) : def merge ( l1 , l2 ) : output_list = [ ] i , j = 0 , 0 while i < len ( l1 ) and j < len ( l2 ) : if l1 [ i ] < l2 [ j ] : output_list . append ( l1 [ i ] ) i += 1 else : output_list . append ( l2 [ j ] ) j += 1 if i == len ( l1 ) : output_list += l2 [ j : ] else : output_list += l1 [ i : ] return output_list     def recursion_part ( l ) : if len ( l ) < 2 : return l else : mid = len ( l ) // 2 left = recursion_part ( l [ : mid ] ) right = recursion_part ( l [ mid : ] ) return merge ( left , right ) return recursion_part ( l )     def list_reverse ( l ) : def recursion ( l , start , end ) : if start >= end : return l else : l [ start ] , l [ end ] = l [ end ] , l [ start ] return recursion ( l , start + 1 , end - 1 ) return recursion ( l , 0 , len ( l ) - 1 )     def divisibility ( n ) : sum = 0 for i in n : sum += int ( i ) return not sum % 4     def recursive_solution ( x ) : if divisibility ( x ) : return int ( x ) else : return recursive_solution ( str ( int ( x ) + 1 ) )     def main_function ( ) : inp = input ( ) return recursive_solution ( inp )                         print ( main_function ( ) ) NEW_LINE


import java . util . Scanner ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ;   short j = input . nextShort ( ) ;   while ( ( ( j / 1000 ) + ( j % 1000 / 100 ) + ( j % 100 / 10 ) + ( j % 10 ) ) % 4 != 0 ) { j ++ ; }   System . out . println ( j ) ; } }


import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; while ( ! check ( a ) ) { a ++ ; } System . out . println ( a ) ; } public static boolean check ( int a ) { int sum = 0 ; while ( a > 0 ) { sum += a % 10 ; a = a / 10 ; } return sum % 4 == 0 ;   } }


import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import java . util . stream . Collectors ; public class _p001183A { static public void main ( final String [ ] args ) throws IOException { p001183A . _main ( args ) ; }


import java . util . Scanner ;   public class NearestInterestingNumber {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; for ( int i = n ; i <= 10000 ; i ++ ) { String s = String . valueOf ( i ) ; int sum = 0 ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { sum += s . charAt ( j ) - '0' ; } if ( sum % 4 == 0 ) { System . out . println ( i ) ; break ; } } }   }


import java . awt . List ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStreamWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . HashSet ; import java . util . PriorityQueue ; import java . util . Random ; import java . util . TreeSet ;       public final class CF_507_D1_A {   static boolean verb = true ; static void log ( Object X ) { if ( verb ) System . err . println ( X ) ; } static void log ( Object [ ] X ) { if ( verb ) { for ( Object U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X ) { if ( verb ) { for ( int U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( int [ ] X , int L ) { if ( verb ) { for ( int i = 0 ; i < L ; i ++ ) System . err . print ( X [ i ] + " ▁ " ) ; System . err . println ( " " ) ; } } static void log ( long [ ] X ) { if ( verb ) { for ( long U : X ) System . err . print ( U + " ▁ " ) ; System . err . println ( " " ) ; } }   static void logWln ( Object X ) { if ( verb ) System . err . print ( X ) ; } static void info ( Object o ) { System . out . println ( o ) ; } static void output ( Object o ) { outputWln ( " " + o + " \n " ) ; } static void outputWln ( Object o ) { try { out . write ( " " + o ) ; } catch ( Exception e ) { } }

n , t = map ( int , input ( ) . split ( ' ▁ ' ) ) aa = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) xx = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) )   res = [ 0 ] * n   prevX = 0 prevV = - 10   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x < prevX or x < i : print ( ' No ' ) exit ( 0 )   curV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) res [ i ] = curV   prevX = x prevV = curV   for i , ( a , x ) in enumerate ( zip ( aa , xx ) ) : x -= 1 if x + 1 < n : if res [ x ] >= aa [ x + 1 ] + t : print ( ' No ' ) exit ( 0 )   print ( ' Yes ' ) print ( * res ) NEW_LINE


def read ( ) : return list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) def fail ( ) : print ( ' No ' ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   res = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( )   prevX = x res [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 )   for i in range ( n ) : x = xx [ i ] - 1 if x + 1 < n and res [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( ' Yes ' ) print ( * res ) NEW_LINE


def read ( ) : return list ( map ( int , input ( ) . split ( ) ) ) def fail ( ) : print ( " No " ) exit ( 0 )   n , t = read ( ) aa = read ( ) xx = read ( )   bb = [ 0 ] * nprevX = 0 prevV = - 10   for i in range ( n ) : x = xx [ i ] - 1 if x < prevX or x < i : fail ( ) prevX = x bb [ i ] = prevV = max ( aa [ i + 1 ] + t if x > i else aa [ i ] + t , prevV + 1 ) for i in range ( n ) : x = xx [ i ] - 1 if x < n - 1 and bb [ x ] >= aa [ x + 1 ] + t : fail ( )   print ( " Yes " ) print ( * bb ) NEW_LINE


import java . io . * ; import java . util . * ;   final public class A {   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; int n = Integer . parseInt ( br . readLine ( ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; Double [ ] arr = new Double [ 2 * n ] ; int non_int = 0 ; double sum_before = 0 , sum = 0 ; for ( int i = 0 ; i < 2 * n ; i ++ ) { double num = Double . parseDouble ( st . nextToken ( ) ) ; sum_before += num ; if ( num != Math . floor ( num ) ) non_int ++ ; sum += Math . floor ( num ) ; arr [ i ] = num ; } double max_sum = Math . min ( n , non_int ) + sum ; double min_sum = Math . max ( 0 , non_int - n ) + sum ; double ans ; if ( min_sum > sum_before ) ans = ( min_sum - sum_before ) ; else if ( max_sum < sum_before ) ans = ( sum_before - max_sum ) ; else { double x = sum_before - Math . floor ( sum_before ) ; ans = Math . min ( 1 - x , x ) ; } System . out . printf ( " % .3f " , ans ) ; } }

from sys import * import mathdef numline ( f = int ) : return map ( f , input ( ) . split ( ) ) n = int ( input ( ) ) a = list ( filter ( lambda x : x != 0 , numline ( lambda s : int ( s . split ( ' . ' ) [ 1 ] ) ) ) ) NEW_LINE


n = int ( input ( ) ) l = list ( map ( float , input ( ) . split ( ) ) ) l = sorted ( [ x - int ( x ) for x in l if x - int ( x ) != 0 ] ) o = 2 * n - len ( l ) su = sum ( l ) ans = 0xFFFFFFFFFFFFFFFf or i in range ( n + 1 ) : if i + o >= n : ans = min ( ans , abs ( i - su ) ) print ( " % .3f " % ans ) NEW_LINE


n = int ( input ( ) )   l = list ( map ( float , input ( ) . split ( ) ) )   l = sorted ( [ x - int ( x ) for x in l if x - int ( x ) != 0 ] )   o = 2 * n - len ( l )   su = sum ( l )   ans = 0xFFFFFFFFFFFFFFF   for i in range ( n + 1 ) :   if i + o >= n :   ans = min ( ans , abs ( i - su ) )   print ( " % .3f " % ans ) NEW_LINE


n = int ( input ( ) ) arr = list ( map ( float , input ( ) . split ( ) ) ) arr = sorted ( [ x - int ( x ) for x in arr if x - int ( x ) != 0 ] ) o = 2 * n - len ( arr ) arr_sum = sum ( arr ) res = int ( 2e9 ) for i in range ( n + 1 ) : if i + o >= n : res = min ( res , abs ( i - arr_sum ) ) print ( " % .3f " % res ) NEW_LINE


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException {


import java . io . ByteArrayInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . nio . charset . StandardCharsets ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class A351 { static class Solver { int N , M , Z , down [ ] , sum , best ; boolean used [ ] ; void solve ( int testNumber , FastScanner s , PrintWriter out ) { N = s . nextInt ( ) ; down = new int [ 2 * N ] ; for ( int i = 0 ; i < 2 * N ; i ++ ) { int spl = Integer . parseInt ( s . next ( ) . split ( " \\ . " ) [ 1 ] ) ; if ( spl == 0 ) Z ++ ; else sum += ( down [ M ++ ] = spl ) ; } int lo = max ( N - Z , 0 ) , hi = min ( N , 2 * N - Z ) ; best = 69_420_1337 ; for ( int i = lo ; i <= hi ; i ++ ) best = min ( best , Math . abs ( sum - 1000 * i ) ) ;


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class Solution2 { private static int MIN = Integer . MIN_VALUE + 5 , MAX = Integer . MAX_VALUE - 5 ; public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ; int N = 2 * n ; StringTokenizer sToken = new StringTokenizer ( reader . readLine ( ) ) ; int [ ] down = new int [ N ] ; int [ ] up = new int [ N ] ; BigDecimal d1000 = new BigDecimal ( "1000.0" ) ; for ( int i = 0 ; i < N ; i ++ ) { double x = Double . parseDouble ( sToken . nextToken ( ) ) ; BigDecimal decimal = new BigDecimal ( x ) ; BigDecimal d = decimal . multiply ( d1000 ) ; d = d . setScale ( 1 , BigDecimal . ROUND_HALF_UP ) ;


import java . util . * ; import java . io . * ; import java . math . * ;   public class x280A { public static void main ( String hi [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; double W = Double . parseDouble ( st . nextToken ( ) ) ; double H = Double . parseDouble ( st . nextToken ( ) ) ; if ( W < H ) { double t = W ; W = H ; H = t ; } int alpha = Integer . parseInt ( st . nextToken ( ) ) ; if ( alpha == 0 || alpha == 180 ) System . out . println ( W * H ) ; else if ( alpha == 90 ) System . out . println ( H * H ) ; else { alpha = Math . min ( alpha , 180 - alpha ) ; double a = rad ( 1.0 * alpha ) ; double b = Math . atan ( 2 * W * H / ( W * W - H * H ) ) ; if ( a >= b ) System . out . println ( H / Math . sin ( a ) * H ) ; else { double ca = Math . cos ( a ) ; double sa = Math . sin ( a ) ; double aa = ( H * ca * ( ca + 1 ) - W * sa * ca ) / ( ( ca + 1 ) * ( ca + 1 ) - sa * sa ) ; double c = H - aa * ( 1 + 1 / ca ) ; double d = c * ca / sa ; double e = c / sa ; double f = aa * sa / ca ; double t1 = aa * f ; double t2 = c * d ; System . out . println ( W * H - t1 - t2 ) ; } } } public static double rad ( double deg ) { return deg * Math . PI / 180 ; } }

import sysimport math     def read_input ( input_path = None ) : if input_path is None : f = sys . stdin else : f = open ( input_path , ' r ' )   w , h , a = map ( int , f . readline ( ) . split ( ) )   return w , h , a     def sol ( w , h , a ) : if h > w : w , h = h , w   if a > 90 : a = 90 - ( a - 90 )   a = math . radians ( a )   if a < 2 * math . atan2 ( h , w ) : area = w * h   s = ( w / 2 ) - ( h / 2 * math . tan ( a / 2 ) ) bigger_area = 0.5 * s * s * math . tan ( a )   s = ( h / 2 ) - ( w / 2 * math . tan ( a / 2 ) ) lower_area = 0.5 * s * s * math . tan ( a )   res = area - 2 * bigger_area - 2 * lower_area else : res = h * h / math . sin ( a )   return [ f " { res } " ]     def solve ( input_path = None ) : return sol ( * read_input ( input_path ) )     def main ( ) : for line in sol ( * read_input ( ) ) : print ( f " { line } " )     if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


from math import * w , h , alpha = [ int ( x ) for x in input ( ) . strip ( ) . split ( ) ] if alpha > 90 : alpha = 180 - alphaif w < h : w , h = h , wc = cos ( alpha * pi / 180.0 ) s = sin ( alpha * pi / 180.0 ) t = tan ( alpha * pi / 360.0 ) print ( h * h / s ) if t > h / w else print ( ( w * h - ( w * w + h * h ) / 2 * tan ( alpha * pi / 360.0 ) ) / ( c ) ) NEW_LINE


from math import cos , pi , sin , atanW , H , b = map ( float , input ( ) . split ( ) ) a = ( b / 180 ) * pi   if ( W < H ) : X = W W = H H = X   if ( a > 0.5 * pi ) : a = 0.5 * pi - ( a - 0.5 * pi )   opp = W * Hif ( a == 0 ) : eindopp = W * Helse : if a > ( atan ( H / W ) * 2 ) : Schuin = H / sin ( a ) eindopp = Schuin * H else : y = - 2 * cos ( a ) - cos ( a ) ** 2 - 1 + sin ( a ) ** 2 hks = ( W * sin ( a ) - H * cos ( a ) - H ) / y hgs = ( H - hks - hks * cos ( a ) ) / sin ( a ) eindopp = opp - hks * sin ( a ) * hks * cos ( a ) - hgs * sin ( a ) * hgs * cos ( a )     print ( round ( eindopp , 9 ) ) NEW_LINE


from math import cos , pi , sin , atanW , H , b = map ( float , input ( ) . split ( ) ) a = ( b / 180 ) * pi   if ( W < H ) : X = W W = H H = X   if ( a > 0.5 * pi ) : a = 0.5 * pi - ( a - 0.5 * pi )   opp = W * Hif ( a == 0 ) : eindopp = W * Helse : if a > ( atan ( H / W ) * 2 ) : Schuin = H / sin ( a ) eindopp = Schuin * H else : y = - 2 * cos ( a ) - cos ( a ) * * 2 - 1 + sin ( a ) * * 2 hks = ( W * sin ( a ) - H * cos ( a ) - H ) / y hgs = ( H - hks - hks * cos ( a ) ) / sin ( a ) eindopp = opp - hks * sin ( a ) * hks * cos ( a ) - hgs * sin ( a ) * hgs * cos ( a )    print ( round ( eindopp , 9 ) )


import java . io . * ; import java . util . * ;   public class practice { 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 scn = new FastReader ( ) ; double l = scn . nextDouble ( ) , b = scn . nextDouble ( ) , a = scn . nextDouble ( ) , sol , t , pi = Math . acos ( - 1.0 ) ; if ( l > b ) { t = l ; l = b ; b = t ; } if ( a == 90 ) { sol = l * l ; System . out . println ( sol ) ; return ; } sol = l * b ; l = l / 2.0 ; b = b / 2.0 ; if ( a > 90 ) a = 180.0 - a ; a = a * pi / 180.0 ; double c = ( pi - a ) / 2 ; double t1 = l - b / Math . tan ( c ) ; sol -= t1 * t1 * Math . tan ( a ) ; double t2 = b - l / Math . tan ( c ) ; sol -= t2 * t2 * Math . tan ( a ) ; if ( t1 < 0 ) { sol = ( l / Math . tan ( a ) + l / Math . tan ( c ) ) * l * 4.0 ; } System . out . println ( sol ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . text . DecimalFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . StringTokenizer ;   public class _501 {   public static void main ( String [ ] args ) { FastScanner fs = new FastScanner ( ) ; double w = fs . nextInt ( ) , h = fs . nextInt ( ) ; int aDeg = fs . nextInt ( ) ; if ( aDeg == 0 || aDeg == 180 ) { System . out . println ( w * h ) ; return ; } if ( aDeg == 90 ) { System . out . println ( Math . min ( w , h ) * Math . min ( h , w ) ) ; return ; } if ( aDeg > 90 ) { aDeg = 180 - aDeg ; }   Seg top = new Seg ( new Vec ( - w / 2 , h / 2 ) , new Vec ( w / 2 , h / 2 ) ) ; Seg bottom = new Seg ( new Vec ( - w / 2 , - h / 2 ) , new Vec ( w / 2 , - h / 2 ) ) ; Seg left = new Seg ( new Vec ( - w / 2 , - h / 2 ) , new Vec ( - w / 2 , h / 2 ) ) ; Seg right = new Seg ( new Vec ( w / 2 , - h / 2 ) , new Vec ( w / 2 , h / 2 ) ) ; Seg [ ] segs = { top , left , bottom , right } ; ArrayList < Vec > all = new ArrayList < > ( ) ; for ( Seg s : segs ) { for ( Seg t : segs ) {


import java . util . Arrays ; import java . util . Scanner ;   public class _0715Ehabandsubtraction {   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 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } Arrays . sort ( arr ) ; int sum = 0 ; for ( int i = 0 ; i < n && k > 0 ; i ++ ) { arr [ i ] = arr [ i ] - sum ; if ( arr [ i ] == 0 ) { continue ; } else { System . out . println ( arr [ i ] ) ; sum += arr [ i ] ; k -- ; } } while ( k > 0 ) { System . out . println ( 0 ) ; k -- ; } }   }

n , k = map ( int , input ( ) . split ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] a . insert ( 0 , 0 ) a = sorted ( list ( set ( a ) ) ) for i in range ( min ( k , len ( a ) - 1 ) ) : print ( a [ i + 1 ] - a [ i ] ) for i in range ( max ( k - len ( a ) + 1 , 0 ) ) : print ( 0 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( map ( int , input ( ) . split ( ) ) ) ) subtract = 0 i = 0 for kk in range ( k ) : if i < n : print ( a [ i ] - subtract ) subtract += a [ i ] - subtract while i < n and a [ i ] <= subtract : i += 1 else : print ( 0 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( set ( map ( int , input ( ) . split ( ) ) ) ) ) for i in range ( k ) : if i == 0 : print ( a [ i ] ) elif i < len ( a ) : print ( a [ i ] - a [ i - 1 ] ) else : print ( 0 ) NEW_LINE


n , k = map ( int , input ( ) . split ( ) ) a = sorted ( list ( set ( map ( int , input ( ) . split ( ) ) ) ) + [ 0 ] ) for i in range ( 1 , k + 1 ) : if i < len ( a ) : print ( a [ i ] - a [ i - 1 ] ) else : print ( 0 ) NEW_LINE


import java . util . * ; import java . util . jar . JarOutputStream ;   public class Practise {    public static void main ( String [ ] args ) {


import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; boolean flag = false ; int [ ] ar = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ;   } Arrays . sort ( ar ) ; long [ ] ar1 = new long [ n ] ; ar1 [ 0 ] = ar [ 0 ] ; long sum = ar [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) {   ar1 [ i ] = ar [ i ] - sum ; sum += ar1 [ i ] ; } List < Long > list = new ArrayList < > ( ) ;   if ( k <= n ) {


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastReader in = new FastReader ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; int n = in . nextInt ( ) , k = in . nextInt ( ) ; ArrayList < Long > list = new ArrayList < > ( ) ; HashSet < Long > set = new HashSet < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Long a = in . nextLong ( ) ; if ( set . contains ( a ) ) continue ; list . add ( a ) ; set . add ( a ) ; } pw . println ( solve ( list , list . size ( ) , k ) ) ; pw . close ( ) ; }   static StringBuilder solve ( ArrayList < Long > arr , int n , int k ) { StringBuilder sb = new StringBuilder ( ) ; long prev = 0 ;


import java . util . * ; import java . io . * ; import java . math . BigInteger ; import java . text . * ; public class Main { static long mod = 1000_000_007 ; static long mod1 = 998244353 ; static boolean fileIO = false ; static boolean memory = true ; static FastScanner f ; static PrintWriter pw ; static double eps = ( double ) 1e-6 ; static FileWriter fw ; static long oo = Long . MAX_VALUE ;

n , k = list ( map ( int , input ( ) . split ( ) ) ) a = n / 2 v = round ( a ) while round ( a ) > 0 : b = 0 m = 0 while v // ( k ** b ) > 0 : m += v // ( k ** b ) b += 1 if m < n : v += round ( a / 2 ) else : v -= round ( a / 2 ) a /= 2 b = 0 m = 0 while v // ( k ** b ) > 0 : m += v // ( k ** b ) b += 1 if m < n : v += 1 print ( v ) NEW_LINE


n , k = [ int ( x ) for x in input ( ) . split ( ) ] import mathdef solve ( num , k ) : divisor = k ans = num while True : temp = math . floor ( num / divisor ) if temp == 0 : break ans += temp divisor *= k return ans   def bs_first_greater ( start , end , n ) : if start > end : return - 1 mid = ( start + end ) // 2 if solve ( mid , k ) >= n : if mid == start : return mid elif solve ( mid - 1 , k ) < n : return mid else : return bs_first_greater ( start , mid - 1 , n )   else : return bs_first_greater ( mid + 1 , end , n )   print ( bs_first_greater ( 1 , n , n ) ) NEW_LINE


def geo_sum ( v , k ) : res = 0 aux = v while aux : res += aux aux //= k return res   def find_v ( n , k ) : st , end = 1 , n while st < end : mid = ( st + end ) // 2 s = geo_sum ( mid , k ) if s == n : return mid if s < n : st = mid + 1 else : end = mid return end   def solve ( ) : n , k = map ( int , input ( ) . split ( ) ) v = find_v ( n , k ) print ( v )   if __name__ == ' _ _ main _ _ ' : solve ( ) NEW_LINE


def valid ( v ) : ans = 0 while v != 0 :   ans += v v = v // k return ans >= n     def BSfindFirst ( start , end ) : while start + 1 < end : mid = ( end + start ) // 2 if valid ( mid ) : end = mid else : start = mid return end     n , k = map ( int , input ( ) . split ( ) ) print ( BSfindFirst ( 0 , 1000000000 ) ) NEW_LINE


def possible ( v , k ) : ans = v prev = k while v // k > 0 : ans += ( v // k ) k *= prev return ansn , k = map ( int , input ( ) . split ( ) ) low = khigh = nans = float ( " inf " ) while low < high : mid = low + ( ( high - low ) // 2 ) if possible ( mid , k ) >= n : high = mid else : low = mid + 1 print ( high ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . lang . reflect . Array ; import java . util . Arrays ; import java . util . HashSet ; import java . util . StringTokenizer ; import java . util . TreeSet ;    public class Main { public static double fun1 ( int v , int k ) { double x = Math . log10 ( ( double ) v ) / Math . log10 ( ( double ) k ) ; int end = ( int ) ( ( x == ( int ) x ) ? x + 1 : ( int ) ( Math . ceil ( x ) ) ) ; int res = 0 ; for ( int i = 0 ; i < end ; i ++ ) { res += v / ( int ) ( Math . pow ( k , i ) ) ; } return res ; } public static int solve ( int n , int k ) { int start = 1 ; int end = ( int ) 1e9 ; int middle ; while ( start <= end ) { middle = ( start + end ) / 2 ; if ( fun1 ( middle , k ) == n ) { return middle ; } else if ( fun1 ( middle , k ) > n ) { if ( fun1 ( middle - 1 , k ) > n || fun1 ( middle - 1 , k ) == n ) { end = middle - 1 ; } else return middle ; } else start = middle + 1 ; } return - 1 ; } public static void main ( String [ ] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String in = bf . readLine ( ) ; StringTokenizer st = new StringTokenizer ( in ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; int k = Integer . parseInt ( st . nextToken ( ) ) ; System . out . println ( solve ( n , k ) ) ; }   }


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int K ; void run ( FastScanner in , PrintWriter out ) {   N = in . nextInt ( ) ; K = in . nextInt ( ) ;   int lo = 1 ; int hi = N + 1 ; int can = - 1 ; while ( lo < hi ) {   int m = ( lo + hi ) >> 1 ; long cnt = cnt ( m ) ; if ( cnt >= N ) { can = m ; hi = m ; } else { lo = m + 1 ; } } out . println ( can ) ; }   long cnt ( int m ) { long ret = 0 ; while ( m > 0 ) { ret += m ; m /= K ; } return ret ; }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream in ) { br = new BufferedReader ( new InputStreamReader ( in ) ) ; st = null ; }   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 ( ) ) ; } } }


import java . util . * ; import java . io . * ; public class ayaa { public static long fun ( long n , int k ) { long sum = n ; while ( n > 0 ) { n = n / k ; sum += n ; } return sum ; } public static long search ( long n , int k ) { long start = 1 ; long end = n ; long mid = ( start + end ) / 2 ; while ( start <= end ) { if ( fun ( mid , k ) < n ) { start = mid + 1 ; } else { end = mid - 1 ; } mid = ( start + end ) / 2 ; } return start ; } public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; long n = sc . nextLong ( ) ; int k = sc . nextInt ( ) ; System . out . println ( search ( n , k ) ) ; } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main {   public static void main ( String [ ] args ) throws IOException { InputStreamReader r = new InputStreamReader ( System . in ) ; BufferedReader br = new BufferedReader ( r ) ; String si = br . readLine ( ) ; String [ ] sa = si . split ( " ▁ " ) ; int n = Integer . valueOf ( sa [ 0 ] ) ; int m = Integer . valueOf ( sa [ 1 ] ) ; StringBuffer str = new StringBuffer ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = br . readLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' - ' ) { str . append ( " - " ) ; } else { if ( ( i + j ) % 2 == 0 ) { str . append ( " B " ) ; } else { str . append ( " W " ) ; } } } str . append ( " \n " ) ; }   System . out . print ( str . toString ( ) ) ;   }   }

n , m = map ( int , input ( ) . split ( ) ) ans = [ ] for i in range ( n ) : if i % 2 == 0 : x = ' B ' else : x = ' W ' s = input ( ) a = ' ' for j in range ( len ( s ) ) : if s [ j ] == ' . ' : a += x else : a += ' - ' if x == ' B ' : x = ' W ' else : x = ' B ' ans . append ( a ) for i in ans : print ( i ) NEW_LINE


import sysdef get_ints ( ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) def get_ints_lists ( ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) def get_string ( ) : return sys . stdin . readline ( ) . strip ( ) n , m = get_ints ( ) for j in range ( n ) : s = get_string ( ) w = " W " b = " B " c = " - " if j % 2 == 0 : if m == 1 : if s [ 0 ] == " . " : print ( b ) else : print ( c ) else : for i in range ( m ) : if s [ i ] == c : print ( c , end = " " ) else : if i % 2 == 0 : print ( b , end = " " ) else : print ( w , end = " " ) print ( ) elif j % 2 == 1 : if m == 1 : if s [ 0 ] == " . " : print ( w ) else : print ( c ) else : for i in range ( m ) : if s [ i ] == c : print ( c , end = " " ) else : if i % 2 == 0 : print ( w , end = " " ) else : print ( b , end = " " ) print ( ) NEW_LINE


r , c = map ( int , input ( ) . split ( ) ) g = [ ]   for _ in range ( r ) : g . append ( list ( input ( ) ) )   for ri in range ( r ) : for ci in range ( c ) : if g [ ri ] [ ci ] == " - " : continue   cm = 1 if ( ri + 1 ) % 2 == 0 : cm *= - 1   if ( ci + 1 ) % 2 == 0 : cm *= - 1   g [ ri ] [ ci ] = " B " if cm == 1 else " W "   print ( " " . join ( g [ ri ] ) ) NEW_LINE


def answer ( n , m , a ) : ctr = 0 for s in a : ans = [ ] for c in s : if c == ' . ' : if ctr % 2 == 0 : ans . append ( ' B ' ) else : ans . append ( ' W ' ) else : ans . append ( ' - ' ) ctr += 1 print ( ' ' . join ( ans ) ) return   def answer2 ( n , m , a ) : for r in range ( n ) : ans = [ ] for c in range ( m ) : if ( r + c ) % 2 == 0 and a [ r ] [ c ] == ' . ' : ans . append ( ' B ' ) elif ( r + c ) % 2 == 1 and a [ r ] [ c ] == ' . ' : ans . append ( ' W ' ) else : ans . append ( ' - ' ) print ( ' ' . join ( ans ) )   def main ( ) : n , m = [ int ( i ) for i in input ( ) . split ( ) ] a = [ 0 ] * n for j in range ( n ) : a [ j ] = input ( ) answer2 ( n , m , a )   returnmain ( ) NEW_LINE


rows , cols = map ( int , input ( ) . split ( ) ) grid = [ input ( ) for _ in range ( rows ) ]   for i in range ( rows ) : for j in range ( cols ) : if grid [ i ] [ j ] == ' . ' : colors = [ ' B ' , ' W ' ] print ( colors [ i % 2 ^ j % 2 ] , end = ' ' ) else : print ( ' - ' , end = ' ' ) print ( ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static char [ ] [ ] array ; public static char [ ] [ ] pos = new char [ ] [ ] { { ' B ' , ' W ' } , { ' W ' , ' B ' } } ; public static void main ( String [ ] args ) {


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . StreamTokenizer ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; char [ ] [ ] ch = new char [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < m ; j ++ ) { if ( s . charAt ( j ) == ' - ' ) { ch [ i ] [ j ] = s . charAt ( j ) ; } else { if ( ( i + j ) % 2 == 0 ) { ch [ i ] [ j ] = ' B ' ; } else { ch [ i ] [ j ] = ' W ' ; } } } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { System . out . print ( ch [ i ] [ j ] ) ; } System . out . println ( ) ; }   }   }


import java . util . Scanner ;   public class Main {   static int count = 0 ; static int n , m ; static int q = 0 ; static boolean bl ;   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; n = scan . nextInt ( ) ; m = scan . nextInt ( ) ; scan . nextLine ( ) ; char [ ] [ ] arr = new char [ n ] [ m ] ; boolean [ ] [ ] visited = new boolean [ n ] [ m ] ; String str = " " ; for ( int i = 0 ; i < n ; i ++ ) { str = scan . nextLine ( ) ; for ( int j = 0 ; j < m ; j ++ ) { arr [ i ] [ j ] = str . charAt ( j ) ; } } f ( arr , visited , 0 , 0 , false ) ; for ( int i = 0 ; i < n ; ++ i ) { for ( int j = 0 ; j < m ; ++ j ) { System . out . print ( arr [ i ] [ j ] ) ; } System . out . println ( ) ; } }   private static void f ( char [ ] [ ] arr , boolean [ ] [ ] visited , int i , int j , boolean flag ) { if ( i == n || j == m )


import java . util . * ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . * ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ; import java . math . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;    public class Sol { public static void main ( String [ ] args ) throws IOException {   Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) ; int c = sc . nextInt ( ) ; char [ ] [ ] mat = new char [ r ] [ c ] ; for ( int i = 0 ; i < r ; i ++ ) { String s = sc . next ( ) ; for ( int j = 0 ; j < c ; j ++ ) { mat [ i ] [ j ] = s . charAt ( j ) ; } } for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { if ( i % 2 == 0 && mat [ i ] [ j ] == ' . ' ) { if ( j % 2 == 0 ) { mat [ i ] [ j ] = ' B ' ; } else { mat [ i ] [ j ] = ' W ' ; } } else if ( i % 2 != 0 && mat [ i ] [ j ] == ' . ' ) { if ( j % 2 == 0 ) { mat [ i ] [ j ] = ' W ' ; } else { mat [ i ] [ j ] = ' B ' ; } } } } for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { System . out . print ( mat [ i ] [ j ] ) ; } System . out . println ( ) ; } } }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; import java . util . StringJoiner ; import java . util . stream . IntStream ; import java . io . PrintWriter ;

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   def main ( ) : n = int ( input ( ) ) clues = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( n ) ] dirs = [ [ int ( i ) for i in input ( ) . split ( ) ] for i in range ( n ) ] sum_x = 0 sum_y = 0 sum_a = 0 sum_b = 0 for i in range ( n ) : sum_x += clues [ i ] [ 0 ] sum_y += clues [ i ] [ 1 ] sum_a += dirs [ i ] [ 0 ] sum_b += dirs [ i ] [ 1 ] x = ( sum_x + sum_a ) // n y = ( sum_y + sum_b ) // n print ( x , y ) main ( ) NEW_LINE


def solve ( n , pillar , clues ) : index = 0 dup_clues = set ( clues ) while index < n : found = True x = pillar [ 0 ] [ 0 ] + clues [ index ] [ 0 ] y = pillar [ 0 ] [ 1 ] + clues [ index ] [ 1 ] for x1 , y1 in pillar : if ( x - x1 , y - y1 ) in dup_clues : continue else : found = False break if found : print ( x , y ) index += 1 NEW_LINE


n = int ( input ( ) ) l1 = [ ] for i in range ( n ) : l1 . append ( [ int ( j ) for j in input ( ) . split ( ) ] ) l2 = [ ] for i in range ( n ) : l2 . append ( [ int ( j ) for j in input ( ) . split ( ) ] ) l1 . sort ( ) l2 . sort ( ) x = l1 [ 0 ] [ 0 ] + l2 [ - 1 ] [ 0 ] y = l1 [ 0 ] [ 1 ] + l2 [ - 1 ] [ 1 ] print ( x , y ) NEW_LINE


'''   ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Online ▁ Python ▁ Compiler . ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ ▁ Code , ▁ Compile , ▁ Run ▁ and ▁ Debug ▁ python ▁ program ▁ online . Write ▁ your ▁ code ▁ in ▁ this ▁ editor ▁ and ▁ press ▁ " Run " ▁ button ▁ to ▁ execute ▁ it .   '''   n = int ( input ( ) ) k = n * 2 l = [ ] m = [ ] for i in range ( 2 * n ) : a , b = map ( int , input ( ) . split ( ) ) if ( i < k // 2 ) : l . append ( ( a , b ) ) else : m . append ( ( a , b ) ) l . sort ( ) m . sort ( reverse = True ) print ( l [ 0 ] [ 0 ] + m [ 0 ] [ 0 ] , l [ 0 ] [ 1 ] + m [ 0 ] [ 1 ] ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ;   public final class new_year { public static void main ( String [ ] args ) throws java . lang . Exception { Reader r = new Reader ( ) ; r . init ( System . in ) ; int n = r . nextInt ( ) ; int [ ] x = new int [ n ] ; int [ ] y = new int [ n ] ; int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ;


import java . util . * ; import java . io . * ; public class tre { public static void main ( String [ ] Args ) throws Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; long x = 0 , y = 0 ; for ( int i = 0 ; i < 2 * n ; i ++ ) { x += sc . nextLong ( ) ; y += sc . nextLong ( ) ;    } System . out . println ( x / n + " ▁ " + y / n ) ;   }   }


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


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 er103b {

from math import ceilfor NEW_LINE ad in range ( int ( input ( ) ) ) : NEW_LINE


from sys import stdin , stdoutstdin . readlinedef NEW_LINE mp ( ) : NEW_LINE return list ( map ( int , stdin . readline ( ) . strip ( ) . split ( ) ) ) NEW_LINE def it ( ) : return int ( stdin . readline ( ) . strip ( ) ) NEW_LINE from collections import defaultdict as dd , Counter as C   NEW_LINE def pf ( n ) : v = [ ] NEW_LINE d = dd ( lambda : 0 ) NEW_LINE while n % 2 == 0 : d [ 2 ] += 1 NEW_LINE n //= 2 NEW_LINE i = 3 NEW_LINE while i * i <= n : if NEW_LINE n % i == 0 : d [ i ] += 1 NEW_LINE n //= i else : i += 1 NEW_LINE if n > 2 : d [ n ] += 1 NEW_LINE return dict ( d )   for _ in range ( it ( ) ) : p , q = mp ( ) NEW_LINE d = pf ( q ) NEW_LINE ans = q NEW_LINE ans = 1 NEW_LINE for i , j in d . items ( ) : k = p NEW_LINE while k % q == 0 : k //= i NEW_LINE ans = max ( ans , k ) NEW_LINE print ( ans ) NEW_LINE


import java . util . * ; public class Problem1444a { static long pi ; static long qi ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { pi = sc . nextLong ( ) ; qi = sc . nextLong ( ) ; long tmpp = pi ; long tmpq = qi ; long ans = 0 ; for ( int i = 2 ; i <= ( long ) ( Math . sqrt ( tmpq ) ) ; i ++ ) { tmpp = pi ; while ( tmpq % i == 0 ) { if ( tmpp % qi != 0 ) { ans = Math . max ( ans , tmpp ) ; } else if ( tmpp % i != 0 ) { } else { tmpp /= i ; continue ; } tmpq /= i ; } } if ( tmpq >= 2 ) { long x = pi ; while ( true ) { if ( x % qi != 0 ) { ans = Math . max ( ans , x ) ; break ; } if ( x % tmpq != 0 ) { break ; } else x /= tmpq ; } } System . out . println ( ans ) ; } } }


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 FastReader sc = new FastReader ( ) ; public static void main ( String [ ] args ) { PrintWriter out = new PrintWriter ( System . out ) ; int t = 1 ; t = sc . nextInt ( ) ; while ( t -- > 0 ) { long p = sc . nextLong ( ) ; long q = sc . nextLong ( ) ; if ( p < q || p % q != 0 ) { out . write ( p + " \n " ) ; continue ; } long j = 2L ; ArrayList < Long > a = new ArrayList < > ( ) ; long ans = q ; while ( j * j <= q ) { if ( ans % j == 0 ) { a . add ( j ) ; while ( ans % j == 0 ) ans /= j ; } j ++ ; } if ( ans > 1 ) { a . add ( ans ) ; ans = 1 ; } for ( long l : a ) { long k = p ; while ( k % q == 0 ) k /= l ; ans = Math . max ( k , ans ) ; } out . write ( ans + " \n " ) ; } out . close ( ) ; } }


import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; String [ ] words = scan . nextLine ( ) . split ( " ▁ " ) ; Set < Set < Character > > roots = new HashSet < > ( ) ; for ( String w : words ) { Set < Character > root = new HashSet < > ( ) ; for ( int i = 0 ; i < w . length ( ) ; i ++ ) { root . add ( w . charAt ( i ) ) ; } roots . add ( root ) ; } System . out . println ( roots . size ( ) ) ; } }

n = int ( input ( ) ) s = list ( str ( input ( ) ) . split ( " ▁ " ) ) k = set ( [ frozenset ( i ) for i in s ] ) print ( len ( k ) ) NEW_LINE


if __name__ == ' _ _ main _ _ ' : n = int ( input ( ) ) l = input ( ) . split ( ) d = dict ( ) for i in l : s = sorted ( set ( i ) ) j = ' ' for i in range ( len ( s ) ) : j += s [ i ] d . setdefault ( j , 0 ) d [ j ] += 1 print ( len ( d ) ) NEW_LINE


input ( ) print ( len ( set ( map ( frozenset , input ( ) . split ( ) ) ) ) ) NEW_LINE