import java . util . Scanner ;   public class BlackSquare { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int [ ] cals = new int [ 5 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { cals [ i + 1 ] = scanner . nextInt ( ) ; }   scanner . nextLine ( ) ; String s = scanner . nextLine ( ) ; int result = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int val = Integer . parseInt ( String . valueOf ( s . charAt ( i ) ) ) ; result += cals [ val ] ; } System . out . println ( result ) ; } }

import java . util . Scanner ; public class Test {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int [ ] calories = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) calories [ i ] = in . nextInt ( ) ; String str = in . next ( ) ; int len = str . length ( ) ; int totCal = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( str . charAt ( i ) == '1' ) totCal += calories [ 0 ] ; else if ( str . charAt ( i ) == '2' ) totCal += calories [ 1 ] ; else if ( str . charAt ( i ) == '3' ) totCal += calories [ 2 ] ; else if ( str . charAt ( i ) == '4' ) totCal += calories [ 3 ] ; } System . out . println ( totCal ) ; } }

import java . util . Scanner ;   public class Maloda {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int a [ ] = new int [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { a [ i ] = in . nextInt ( ) ; } String s = in . next ( ) ; int t = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { t += a [ Integer . parseInt ( String . valueOf ( s . charAt ( i ) ) ) - 1 ] ; } System . out . println ( t ) ; } }

import java . util . Scanner ;    public class BlackSquare {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int c1 = 0 , c2 = 0 , c3 = 0 , c4 = 0 ; int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; int a3 = sc . nextInt ( ) ; int a4 = sc . nextInt ( ) ; String s = sc . next ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == '1' ) c1 += a1 ; else if ( s . charAt ( i ) == '2' ) c2 += a2 ; else if ( s . charAt ( i ) == '3' ) c3 += a3 ; else c4 += a4 ; } System . out . println ( c1 + c2 + c3 + c4 ) ; } }

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

a = list ( map ( int , input ( ) . split ( ) ) ) s , ans = input ( ) , 0 for x in s : ans += a [ int ( x ) - 1 ] print ( ans ) NEW_LINE

cost = [ int ( i ) for i in input ( ) . split ( ) ] s = input ( )   total = 0   for i in s : total += cost [ int ( i ) - 1 ] print ( total ) NEW_LINE

import sysinput = sys . stdin . readline   '''   '''   a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) r = input ( ) . rstrip ( ) score = 0 for s in map ( int , r ) : score += a [ s ]   print ( score )   NEW_LINE

n , m , a , b = map ( int , input ( ) . split ( ) ) s = input ( ) su = 0 for i in s : if ( i == '1' ) : su += n elif ( i == '2' ) : su += m elif ( i == '3' ) : su += a else : su += bprint ( su ) NEW_LINE


import java . util . Comparator ; import java . util . PriorityQueue ; import java . util . Scanner ;   public class ProblemB { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; PriorityQueue pq = new PriorityQueue < int [ ] > ( Comparator . comparingInt ( o -> ( ( int [ ] ) o ) [ 0 ] ) . reversed ( ) ) ; for ( int i = 1 ; i < 2 * n ; i ++ ) for ( int j = 0 ; j < i ; j ++ ) pq . add ( new int [ ] { sc . nextInt ( ) , i , j } ) ;   int [ ] used = new int [ 2 * n ] ; while ( ! pq . isEmpty ( ) ) { int [ ] value = ( int [ ] ) pq . poll ( ) ; if ( used [ value [ 1 ] ] == 0 && used [ value [ 2 ] ] == 0 ) { used [ value [ 1 ] ] = value [ 2 ] + 1 ; used [ value [ 2 ] ] = value [ 1 ] + 1 ; } }   StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < 2 * n ; i ++ ) { builder . append ( used [ i ] ) ; if ( i != 2 * n - 1 ) builder . append ( " ▁ " ) ; } System . out . println ( builder ) ; } }

import java . util . * ; import java . io . * ;   public class B { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int n = Integer . parseInt ( f . readLine ( ) ) ; int [ ] [ ] strength = new int [ 2 * n ] [ 2 * n ] ; for ( int i = 1 ; i < 2 * n ; i ++ ) { StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; for ( int j = 0 ; j < i ; j ++ ) { strength [ i ] [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; strength [ j ] [ i ] = strength [ i ] [ j ] ; } } HashSet < Integer > seen = new HashSet < Integer > ( ) ; int [ ] teams = new int [ 2 * n ] ; for ( int i = 0 ; i < n ; i ++ ) { int maxr = - 1 ; int maxc = - 1 ; int maxS = Integer . MIN_VALUE ; for ( int j = 0 ; j < 2 * n ; j ++ ) { if ( seen . contains ( j ) ) continue ; for ( int k = 0 ; k <= j ; k ++ ) { if ( seen . contains ( k ) ) continue ; if ( strength [ j ] [ k ] > maxS ) { maxr = j ; maxc = k ; maxS = strength [ j ] [ k ] ; } } } seen . add ( maxc ) ; seen . add ( maxr ) ; teams [ maxr ] = maxc + 1 ; teams [ maxc ] = maxr + 1 ; } StringBuilder ans = new StringBuilder ( ) ; for ( int i : teams ) { ans . append ( i ) ; ans . append ( " ▁ " ) ; } out . println ( ans . toString ( ) . trim ( ) ) ; out . close ( ) ;   } }

import java . util . * ; import java . io . * ; import java . math . * ;   public class B { public static void main ( String omkar [ ] ) throws Exception { BufferedReader infile = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( infile . readLine ( ) ) ; int N = Integer . parseInt ( st . nextToken ( ) ) ; ArrayList < Thing > ls = new ArrayList < Thing > ( ) ; for ( int i = 0 ; i < 2 * N - 1 ; i ++ ) { st = new StringTokenizer ( infile . readLine ( ) ) ; int a = i + 2 ; for ( int b = 1 ; b < a ; b ++ ) { int v = Integer . parseInt ( st . nextToken ( ) ) ; ls . add ( new Thing ( a , b , v ) ) ; } } Collections . sort ( ls ) ; HashSet < Integer > seen = new HashSet < Integer > ( ) ; int [ ] res = new int [ 2 * N + 1 ] ; for ( Thing t : ls ) { if ( seen . contains ( t . a ) || seen . contains ( t . b ) ) continue ; seen . add ( t . a ) ; seen . add ( t . b ) ; res [ t . a ] = t . b ; res [ t . b ] = t . a ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= 2 * N ; i ++ ) sb . append ( res [ i ] + " ▁ " ) ; System . out . println ( sb ) ; } } class Thing implements Comparable < Thing > { public int a ; public int b ; public int val ; public Thing ( int x , int y , int z ) { a = x ; b = y ; val = z ; } public int compareTo ( Thing oth ) { return oth . val - val ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class test { 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 ( ) ) ; int [ ] teammates = new int [ 2 * n + 1 ] ; int [ ] [ ] strength = new int [ 2 * n + 1 ] [ 2 * n + 1 ] ;   for ( int i = 2 ; i <= 2 * n ; i ++ ) { StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; for ( int j = 1 ; j < i ; j ++ ) { strength [ i ] [ j ] = Integer . parseInt ( st . nextToken ( ) ) ; } } for ( int t = 0 ; t < n ; t ++ ) { int max = 0 ; int [ ] maxIdx = new int [ 2 ] ; for ( int i = 2 ; i <= 2 * n ; i ++ ) { for ( int j = 1 ; j < i ; j ++ ) { if ( teammates [ i ] != 0 || teammates [ j ] != 0 ) continue ; if ( strength [ i ] [ j ] > max ) { maxIdx [ 0 ] = i ; maxIdx [ 1 ] = j ; max = strength [ i ] [ j ] ; } } } teammates [ maxIdx [ 0 ] ] = maxIdx [ 1 ] ; teammates [ maxIdx [ 1 ] ] = maxIdx [ 0 ] ; } for ( int i = 1 ; i <= 2 * n ; i ++ ) sb . append ( teammates [ i ] ) . append ( " ▁ " ) ; System . out . println ( sb ) ; } }

import sys   N = int ( sys . stdin . readline ( ) ) members = list ( ) list_sum = list ( ) for i in range ( 2 * N - 1 ) : members . append ( list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) ) for j in range ( len ( members [ i ] ) ) : list_sum . append ( [ members [ i ] [ j ] , ( i + 2 , j + 1 ) ] )   list_sum . sort ( key = lambda x : x [ 0 ] , reverse = True )   members_set = set ( ) teammates = [ 0 ] * 2 * N   for one_list in list_sum : if N == 0 : break   elif one_list [ 1 ] [ 0 ] not in members_set and one_list [ 1 ] [ 1 ] not in members_set : members_set . add ( one_list [ 1 ] [ 0 ] ) members_set . add ( one_list [ 1 ] [ 1 ] ) teammates [ one_list [ 1 ] [ 0 ] - 1 ] = one_list [ 1 ] [ 1 ] teammates [ one_list [ 1 ] [ 1 ] - 1 ] = one_list [ 1 ] [ 0 ] N -= 1 continue   print ( ' ▁ ' . join ( repr ( e ) for e in teammates ) ) NEW_LINE

from sys import stdin , stdoutn = int ( stdin . readline ( ) ) a = [ ] b = [ False ] * 2 * nfor i in range ( 1 , 2 * n ) : a += [ [ int ( f ) , i ] for f in stdin . readline ( ) . split ( ) ] for j in range ( i ) : a [ - i + j ] . append ( j )   a . sort ( reverse = True )   ans = [ ] for i in range ( len ( a ) ) : if b [ a [ i ] [ 1 ] ] == False and b [ a [ i ] [ 2 ] ] == False : b [ a [ i ] [ 1 ] ] = a [ i ] [ 2 ] + 1 b [ a [ i ] [ 2 ] ] = a [ i ] [ 1 ] + 1   print ( * b ) NEW_LINE

a = int ( input ( ) ) z = [ ] for i in range ( 2 , 2 * a + 1 ) : for j , k in enumerate ( map ( int , input ( ) . split ( ) ) ) : z . append ( [ k , i , j + 1 ] ) k = [ 0 ] * ( 2 * a + 1 ) for i in sorted ( z ) [ : : - 1 ] : if k [ i [ 1 ] ] == 0 and k [ i [ 2 ] ] == 0 : k [ i [ 1 ] ] = i [ 2 ] ; k [ i [ 2 ] ] = i [ 1 ] print ( * k [ 1 : : ] ) NEW_LINE

n = int ( input ( ) ) d = dict ( ) for i in range ( 2 , 2 * n + 1 ) : l = list ( map ( int , input ( ) . split ( ) ) ) for j in range ( 1 , i ) : d [ l [ j - 1 ] ] = ( i , j ) f = [ 0 for i in range ( 0 , 2 * n + 1 ) ] for i in reversed ( sorted ( d . keys ( ) ) ) : if f [ d [ i ] [ 0 ] ] == 0 and f [ d [ i ] [ 1 ] ] == 0 : f [ d [ i ] [ 0 ] ] = d [ i ] [ 1 ] f [ d [ i ] [ 1 ] ] = d [ i ] [ 0 ] for i in range ( 1 , 2 * n + 1 ) : print ( f [ i ] , end = ' ▁ ' ) NEW_LINE

n = int ( input ( ) ) arr = [ ] ans = [ 0 ] * ( 2 * n + 1 ) vis = [ 0 ] * ( 2 * n + 1 ) for i in range ( 2 , 2 * n + 1 ) : temp = list ( map ( int , input ( ) . split ( ) ) ) for j in range ( 1 , i ) : arr . append ( [ temp [ j - 1 ] , i , j ] ) arr . sort ( reverse = True ) for i in arr : if vis [ i [ 1 ] ] or vis [ i [ 2 ] ] : continue ans [ i [ 1 ] ] = i [ 2 ] ans [ i [ 2 ] ] = i [ 1 ] vis [ i [ 1 ] ] = 1 vis [ i [ 2 ] ] = 1 print ( * ans [ 1 : ] ) NEW_LINE


import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; Map < Integer , Integer > map1 = new HashMap < > ( ) ; Map < Integer , Integer > map2 = new HashMap < > ( ) ;

import java . util . HashSet ; import java . util . Iterator ; import java . util . Scanner ;   public class A181 { public static void main ( String q [ ] ) { Scanner sc = new Scanner ( System . in ) ; int r = sc . nextInt ( ) , c = sc . nextInt ( ) ; HashSet < Integer > x = new HashSet < Integer > ( ) ; HashSet < Integer > y = new HashSet < Integer > ( ) ; for ( int i = 1 ; i <= r ; i ++ ) { String s = sc . next ( ) ; char ar [ ] = s . toCharArray ( ) ; for ( int j = 1 ; j <= ar . length ; j ++ ) { if ( ar [ j - 1 ] == ' * ' ) { if ( x . contains ( i ) ) x . remove ( i ) ; else x . add ( i ) ; if ( y . contains ( j ) ) y . remove ( j ) ; else y . add ( j ) ; } } } Iterator itx = x . iterator ( ) ; Iterator ity = y . iterator ( ) ; System . out . println ( itx . next ( ) + " ▁ " + ity . next ( ) ) ; } }

import java . util . * ; public class Berland { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int i , j , p = 0 , q = 0 ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; int a [ ] [ ] = new int [ 3 ] [ 2 ] ; for ( i = 0 ; i < 3 ; i ++ ) { for ( j = 0 ; j < 2 ; j ++ ) { a [ i ] [ j ] = 0 ; } } String s [ ] [ ] = new String [ n ] [ 1 ] ; for ( i = 0 ; i < n ; i ++ ) { s [ i ] [ 0 ] = in . next ( ) ; } for ( i = 0 ; i < n ; i ++ ) { for ( j = 0 ; j < m ; j ++ ) { if ( s [ i ] [ 0 ] . charAt ( j ) == ' * ' ) { a [ p ] [ q ] = i ; q = q + 1 ; a [ p ] [ q ] = j ; p = p + 1 ; q = 0 ; } } } if ( a [ 0 ] [ 0 ] == a [ 1 ] [ 0 ] ) { System . out . print ( ( a [ 2 ] [ 0 ] + 1 ) + " ▁ " ) ; } else if ( a [ 0 ] [ 0 ] == a [ 2 ] [ 0 ] ) { System . out . print ( ( a [ 1 ] [ 0 ] + 1 ) + " ▁ " ) ; } else { System . out . print ( ( a [ 0 ] [ 0 ] + 1 ) + " ▁ " ) ; } if ( a [ 0 ] [ 1 ] == a [ 1 ] [ 1 ] ) { System . out . println ( a [ 2 ] [ 1 ] + 1 ) ; } else if ( a [ 0 ] [ 1 ] == a [ 2 ] [ 1 ] ) { System . out . println ( a [ 1 ] [ 1 ] + 1 ) ; } else { System . out . println ( a [ 0 ] [ 1 ] + 1 ) ; } } }

import java . util . * ;   public class questionCF { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; String a [ ] = new String [ n ] ; int num [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int count = 0 ; a [ i ] = sc . next ( ) ; for ( int j = 0 ; j < a [ i ] . length ( ) ; j ++ ) { if ( a [ i ] . charAt ( j ) == ' * ' ) count ++ ; } num [ i ] = count ; } int mi = 0 , max = 0 , si = 0 , smax = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( max < num [ i ] ) { max = num [ i ] ; mi = i ; } } num [ mi ] = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( smax < num [ i ] ) { smax = num [ i ] ; si = i ; } } String x = a [ mi ] ; String y = a [ si ] ; for ( int i = 0 ; i < m ; i ++ ) if ( x . charAt ( i ) != y . charAt ( i ) ) { System . out . println ( ( si + 1 ) + " ▁ " + ( i + 1 ) ) ; break ; } } }

from collections import Counter as c n , m = [ int ( i ) for i in input ( ) . split ( ) ] a = [ ] x = [ ] y = [ ] for i in range ( n ) : a . append ( input ( ) ) for i in range ( n ) : for j in range ( m ) : if a [ i ] [ j ] == ' * ' : x . append ( j ) y . append ( i ) a = c ( x ) for i in a : if a [ i ] == 1 : col = i b = c ( y ) for i in b : if b [ i ] == 1 : row = i print ( row + 1 , ' ▁ ' , col + 1 ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) mat = [ ] cor = [ ]   for _ in range ( n ) : mat . append ( input ( ) )   for i in range ( n ) : for j in range ( m ) : if mat [ i ] [ j ] == ' * ' : cor . append ( ( i , j ) )   if cor [ 0 ] [ 1 ] == cor [ 1 ] [ 1 ] : NEW_LINE

n , m = input ( ) . split ( ) table = [ ] row = [ ] for i in range ( int ( n ) ) :   a = str ( input ( ) ) table . append ( a ) if a . find ( ' * ' ) >= 0 : row . append ( i ) for i in range ( int ( m ) ) : if table [ row [ 0 ] ] [ i ] == ' * ' and table [ row [ 1 ] ] [ i ] == ' * ' : continue elif table [ row [ 0 ] ] [ i ] == ' * ' and table [ row [ 1 ] ] [ i ] != ' * ' : print ( " { } ▁ { } " . format ( row [ 1 ] + 1 , i + 1 ) ) elif table [ row [ 0 ] ] [ i ] != ' * ' and table [ row [ 1 ] ] [ i ] == ' * ' : print ( " { } ▁ { } " . format ( row [ 0 ] + 1 , i + 1 ) )                   NEW_LINE

R = lambda : map ( int , input ( ) . split ( ) ) N = lambda : list ( input ( ) ) n , m = R ( ) mapping = [ ] for i in range ( n ) : k = N ( ) mapping . append ( k ) columns = [ ] corr = [ ] n_c = [ ] for ran , row in enumerate ( mapping ) : n_star = 0 for town , point in enumerate ( row ) : if point == ' * ' : n_star += 1 columns . append ( town + 1 ) if n_star == 1 : n_c . append ( columns [ - 1 ] ) corr . append ( ran + 1 ) corr . append ( list ( set ( columns ) - set ( n_c ) ) [ 0 ] ) print ( * corr ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   static void sort ( int a [ ] ) { Random ran = new Random ( ) ; for ( int i = 0 ; i < a . length ; i ++ ) { int r = ran . nextInt ( a . length ) ; int temp = a [ r ] ; a [ r ] = a [ i ] ; a [ i ] = temp ; }   Arrays . sort ( a ) ; } public static void main ( String [ ] args ) throws IOException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int count = 1 ; for ( int i = 0 ; i < k ; i ++ ) { int q = input . nextInt ( ) ; for ( int j = 1 ; j <= q ; j ++ ) { int value = input . nextInt ( ) ; if ( j != value ) { count += 2 ; } } count -- ; } System . out . println ( count ) ; }   }

import java . util . Arrays ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] [ ] a = new int [ k ] [ ] ; for ( int i = 0 ; i < a . length ; i ++ ) { int m = sc . nextInt ( ) ; a [ i ] = new int [ m ] ; for ( int j = 0 ; j < a [ i ] . length ; j ++ ) { a [ i ] [ j ] = sc . nextInt ( ) ; } } System . out . println ( solve ( n , a ) ) ;   sc . close ( ) ; }   static int solve ( int n , int [ ] [ ] a ) { int oneLength = 1 ; for ( int [ ] ai : a ) { if ( ai [ 0 ] == 1 ) { while ( oneLength < ai . length && ai [ oneLength ] - ai [ oneLength - 1 ] == 1 ) { oneLength ++ ; } } }   return Arrays . stream ( a ) . mapToInt ( ai -> ai . length - 1 ) . sum ( ) + ( n - 1 ) - ( oneLength - 1 ) * 2 ; } }

import java . util . * ;   import static java . lang . System . out ;   public class Main {   Scanner scanner = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { new Main ( ) . solve ( ) ; }   void solve ( ) {   int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ;   int ans = 0 ; for ( int i = 0 ; i < k ; i ++ ) { int l = scanner . nextInt ( ) ; int a [ ] = new int [ l ] ; for ( int j = 0 ; j < l ; j ++ ) { a [ j ] = scanner . nextInt ( ) ; } int t = 0 ; if ( a [ 0 ] == 1 ) { for ( int j = 0 ; j < l - 1 ; j ++ ) { if ( a [ j + 1 ] - a [ j ] == 1 ) { t ++ ; } else { break ; } } } ans += ( l - t - 1 ) * 2 + 1 ; } ans -- ; out . println ( ans ) ; } }

n , k = map ( int , input ( ) . split ( ) ) for _ in range ( k ) : a = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] + [ 0 ] if a [ 0 ] != 1 : continue i = 0 while a [ i + 1 ] == i + 2 : i += 1 NEW_LINE

n , m = ( int ( x ) for x in input ( ) . split ( ) ) ans = 2 * n - m - 1 for i in range ( m ) : a = [ int ( x ) for x in input ( ) . split ( ) ] for j in range ( 1 , a [ 0 ] ) : if a [ j + 1 ] == j + 1 and a [ j ] == j : ans -= 2 else : breakprint ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) l = 0 g = kfor i in range ( k ) : s , * x = map ( int , input ( ) . split ( ) ) if x [ 0 ] == 1 : for i in range ( s ) : if x [ i ] != i + 1 : i -= 1 break i += 1 breakans = ( n - 1 ) + ( n - k ) - 2 * ( i - 1 ) print ( ans ) NEW_LINE


import java . util . Scanner ;   public class JavaApplication1 {    public static void main ( String [ ] args ) { Scanner read = new Scanner ( System . in ) ; int n , k , x , f , t = 0 , j ; n = read . nextInt ( ) ; k = read . nextInt ( ) ; x = read . nextInt ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { f = read . nextInt ( ) ; if ( i <= n - k ) { t += f ; } } j = t + k * x ; System . out . println ( j ) ; } }

import java . util . * ; public class P2 {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } int sum = 0 ; for ( int i = 0 ; i < n - k ; i ++ ) { sum += a [ i ] ; } System . out . println ( sum + ( k * x ) ) ; } }

import io , osinput = io . BytesIO ( os . read ( 0 , os . fstat ( 0 ) . st_size ) ) . readline   n , k , x = map ( int , input ( ) . split ( ) ) l = [ int ( x ) for x in input ( ) . split ( ) ] ans = 0 for i in range ( n - k ) : ans += l [ i ]   for i in range ( k ) : ans += x   print ( ans ) NEW_LINE

if __name__ == " _ _ main _ _ " : n , k , x = list ( map ( int , input ( ) . split ( ) ) ) chore_times = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( 1 , k + 1 ) : chore_times [ - i ] = x print ( sum ( chore_times ) ) NEW_LINE

n , k , x = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) )   ans = 0 while k and arr and arr [ - 1 ] > x : arr . pop ( ) ans += x k -= 1   print ( ans + sum ( arr ) ) NEW_LINE

n , k , x = map ( int , input ( ) . split ( ' ▁ ' ) ) chores = list ( map ( int , input ( ) . split ( ' ▁ ' ) ) ) print ( k * x + sum ( chores [ 0 : n - k ] ) ) NEW_LINE


import java . io . * ; import java . util . * ; import static java . lang . Math . * ; public class Task { public static void main ( String [ ] args ) throws IOException { Reader reader = new Reader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = reader . nextInt ( ) ; int m = reader . nextInt ( ) ; int k = reader . nextInt ( ) ; int x = 0 ; int lo = 1 ; int hi = m ; while ( lo <= hi ) { int mid = ( lo + hi ) / 2 ; long p = mid ; long sum = p ; long y1 = n - k ; long y2 = k - 1 ;   if ( y1 > p - 1 ) { sum += y1 + ( p - 1 ) * p / 2 - ( p - 1 ) ; } else { sum += p * y1 - y1 * ( y1 + 1 ) / 2 ; } if ( y2 > p - 1 ) { sum += y2 + ( p - 1 ) * p / 2 - ( p - 1 ) ; } else { sum += p * y2 - y2 * ( y2 + 1 ) / 2 ; }   if ( sum <= m ) { x = max ( x , mid ) ; lo = mid + 1 ; } else { hi = mid - 1 ; } } out . println ( x ) ; reader . close ( ) ; out . close ( ) ; } } class Reader { private BufferedReader bufferedReader ; private StringTokenizer tokenizer ; public Reader ( ) { bufferedReader = new BufferedReader ( new InputStreamReader ( System . in ) , 32786 ) ; } public void close ( ) throws IOException { bufferedReader . close ( ) ; } public String next ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( bufferedReader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } }

import java . io . * ; import java . util . * ;   import javax . print . attribute . HashAttributeSet ;   import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . security . cert . TrustAnchor ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ;

import java . util . * ; import java . io . * ;   public class B760 { public static void main ( String [ ] args ) throws Exception { in . init ( System . in ) ; long n = in . nextLong ( ) ;

def just_sum ( n ) : return ( n * ( n + 1 ) ) // 2 def get_sum ( a , b ) : return just_sum ( b ) - just_sum ( a - 1 )     def check ( mid , k , n , sn ) : left = k - 1 right = n - k if ( left < mid ) : left_sum = get_sum ( mid - left , mid - 1 ) else : left_sum = just_sum ( mid - 1 ) if ( right < mid ) : right_sum = get_sum ( mid - right , mid - 1 ) else : right_sum = just_sum ( mid - 1 ) return left_sum + right_sum + mid <= sn     def binary_search ( n , k , sn ) : low = 0 high = sn while ( low < high ) : mid = low + ( high - low + 1 ) // 2 if ( check ( mid , k , n , sn ) ) : low = mid else : high = mid - 1 return low     n , m , k = map ( int , input ( ) . split ( ) ) sn = m - nprint ( binary_search ( n , k , sn ) + 1 ) NEW_LINE

def distribute ( target , n , k , m ) : right = n - k prev = target - 1 total = m - target if right >= prev : total -= ( ( prev * ( prev + 1 ) ) // 2 ) total -= right - prev else : temp = prev - right total -= ( ( prev * ( prev + 1 ) ) // 2 ) - ( ( temp * ( temp + 1 ) ) // 2 ) right = k - 1 prev = target - 1 if right >= prev : total -= ( ( prev * ( prev + 1 ) ) // 2 ) total -= right - prev else : temp = prev - right total -= ( ( prev * ( prev + 1 ) ) // 2 ) - ( ( temp * ( temp + 1 ) ) // 2 )   if total < 0 : return - 1 else : return 1         n , m , k = map ( int , input ( ) . split ( ) ) low = 1 high = m - n + 1 while low <= high : mid = low + ( high - low ) // 2 val = distribute ( mid , n , k , m ) if val == - 1 : high = mid - 1 else : low = mid + 1 print ( high )               NEW_LINE

import sysinput = sys . stdin . readlinedef f ( x ) : z = m - n if ( x > k ) : NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) ) a = m - nif n == 1 : print ( m ) elif n == 2 : print ( ( m + 1 ) // 2 ) else : if a == 0 : print ( 1 ) else : l = 0 h = a ans = 1 while l <= h : m = ( l + h ) // 2 if m <= k : x = ( m * ( m + 1 ) ) // 2 else : z = m - k x = ( m * ( m + 1 ) ) // 2 - ( z * ( z + 1 ) ) // 2 if m <= n - k + 1 : y = ( m * ( m + 1 ) ) // 2 else : z = m - ( n - k + 1 ) y = ( m * ( m + 1 ) ) // 2 - ( z * ( z + 1 ) ) // 2 if x + y - m <= a : l = m + 1 ans = m continue else : h = m - 1 continue if l == h : break print ( ans + 1 ) NEW_LINE

n , m , k = map ( int , input ( ) . split ( ) )   l = 1 r = mans = 0 while ( l <= r ) : mid = ( l + r ) // 2 maxa = min ( mid * n , m ) mini = 0 print if ( mid < k ) : mini += ( mid * ( mid + 1 ) ) // 2 + ( k - mid ) else : mini += ( mid * ( mid + 1 ) ) // 2 t = mid - k mini -= t * ( t + 1 ) // 2 spots = n - k mid -= 1 if ( mid < spots ) : mini += ( mid * ( mid + 1 ) ) // 2 + ( spots - mid ) else : mini += ( mid * ( mid + 1 ) ) // 2 t = mid - spots mini -= ( t * ( t + 1 ) ) // 2 mid += 1 if ( maxa < m ) : l = mid + 1 elif ( mini <= m <= maxa ) : ans = max ( mid , ans ) l = mid + 1 else : r = mid - 1 print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . * ;   import static java . lang . System . out ; public class c693a {

import java . util . ArrayList ; import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; ArrayList < ArrayList < Integer > > graph = new ArrayList < > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { graph . add ( new ArrayList < Integer > ( ) ) ; } for ( int i = 0 ; i < m ; i ++ ) { int start = sc . nextInt ( ) ; int end = sc . nextInt ( ) ; graph . get ( start - 1 ) . add ( end - 1 ) ; graph . get ( end - 1 ) . add ( start - 1 ) ; }   int [ ] sizeCount = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int count = graph . get ( i ) . size ( ) ; sizeCount [ count ] = sizeCount [ count ] + 1 ; } if ( sizeCount [ 2 ] == n - 2 && sizeCount [ 1 ] == 2 ) System . out . println ( " bus ▁ topology " ) ; else if ( sizeCount [ 2 ] == n ) System . out . println ( " ring ▁ topology " ) ; else if ( sizeCount [ n - 1 ] == 1 && sizeCount [ 1 ] == n - 1 ) System . out . println ( " star ▁ topology " ) ; else System . out . println ( " unknown ▁ topology " ) ; } }

import java . io . * ; import java . math . * ; import java . util . * ; import java . text . * ;   public class Main { private static FastIO sc ;   public static void main ( String [ ] args ) { sc = new FastIO ( System . in , System . out ) ;

from collections import defaultdictn , m = map ( int , input ( ) . split ( ) ) h = defaultdict ( set ) nums = [ 0 ] * nfor i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) h [ u ] . add ( v ) h [ v ] . add ( u )   full = 0 one = 0 two = 0 for key , value in h . items ( ) : if len ( value ) == n - 1 : full += 1 if len ( value ) == 1 : one += 1 if len ( value ) == 2 : two += 1 if full == 1 and full + one == n : print ( ' star ▁ topology ' ) elif two == n : print ( ' ring ▁ topology ' ) elif two == n - 2 and one == 2 : print ( ' bus ▁ topology ' )   else : print ( ' unknown ▁ topology ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) g = [ 0 for _ in range ( n ) ] for _ in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) g [ x - 1 ] += 1 g [ y - 1 ] += 1 if m == n and max ( g ) == min ( g ) == 2 : print ( ' ring ▁ topology ' ) elif m == n - 1 and max ( g ) < 3 : print ( ' bus ▁ topology ' ) elif m == n - 1 and max ( g ) == n - 1 : print ( ' star ▁ topology ' ) else : print ( ' unknown ▁ topology ' ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) graph = { i : [ ] for i in range ( 1 , n + 1 ) } for i in range ( m ) : u , v = map ( int , input ( ) . split ( ) ) graph [ u ] . append ( v ) graph [ v ] . append ( u ) degree = { i : 0 for i in range ( 1 , n + 1 ) } tot_degree = { i : 0 for i in range ( 1 , n + 1 ) } for i in range ( 1 , n + 1 ) : ln = len ( graph [ i ] ) degree [ i ] = ln tot_degree [ ln ] += 1 NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) counter = [ 0 ] * nfor i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) counter [ x - 1 ] += 1 counter [ y - 1 ] += 1   NEW_LINE


import java . util . ArrayList ; import java . util . Collections ; import java . util . Scanner ;   public class Solution {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int wbn = sc . nextInt ( ) ; int lwc = sc . nextInt ( ) ; waterBorn [ ] wb = new waterBorn [ wbn ] ; ArrayList < waterBorn > wb1 = new ArrayList < waterBorn > ( ) ; ArrayList < waterBorn > wb2 = new ArrayList < waterBorn > ( ) ;   int t1 = 0 ; for ( int i = 0 ; i < wbn ; i ++ ) { wb [ i ] = new waterBorn ( sc . nextInt ( ) , sc . nextInt ( ) , i + 1 ) ; if ( wb [ i ] . t == 1 ) wb1 . add ( wb [ i ] ) ; else wb2 . add ( wb [ i ] ) ; } sc . close ( ) ;   long start = System . nanoTime ( ) ;

import java . util . ArrayList ; import java . util . Comparator ; import java . util . List ; import java . util . Scanner ;   public class T3B {   static Scanner in = new Scanner ( System . in ) ;   static int n ; static int v ;   static List < Ship > baidarkas = new ArrayList < > ( ) ; static List < Ship > katamarans = new ArrayList < > ( ) ;   static int indexLastBaidarka ; static int indexLastKatamaran ;   public static void main ( String [ ] args ) {   init ( ) ;

''' Jana ▁ Goodman Lorry  ▁ ▁ ▁ ▁ use ▁ distribution ▁ of ▁ types ▁ of ▁ boats ▁ ▁ ▁ ▁ x ▁ + ▁ 2y ▁ < = ▁ volume ▁ where ▁ x , ▁ y ▁ = ▁ # kayaks , ▁ # catamarans  '''   import timeimport itertools   KAYAK = 1 CATAMARAN = 2   def get_boats ( num_boats ) : kayaks , catamarans = list ( ) , list ( ) for boat_num in range ( 1 , num_boats + 1 ) : type_boat , cap = map ( int , input ( ) . strip ( ) . split ( ' ▁ ' ) ) if type_boat == KAYAK : kayaks . append ( ( cap , boat_num ) ) else : catamarans . append ( ( cap , boat_num ) ) kayaks . sort ( reverse = True ) catamarans . sort ( reverse = True ) return kayaks , catamarans   def get_maxes ( kayaks , catamarans , dists ) : NEW_LINE

import sys   n , v = list ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( ) ) ) kc_ls = [ ] kayaks = [ ] catamaran = [ ] total_space = 0 total_capacity = 0 for i in range ( 1 , n + 1 ) : kc_ls . append ( tuple ( map ( int , sys . stdin . readline ( ) . rstrip ( ) . split ( ) + [ i ] ) ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {   public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int angle = input . nextInt ( ) ; int ans = 3 ; double dif = Double . MAX_VALUE ; for ( int i = 3 ; i <= n ; i ++ ) { if ( dif > Math . abs ( ( 180.0 * ( i - 2 ) ) / n - angle ) ) { dif = Math . abs ( ( 180.0 * ( i - 2 ) ) / n - angle ) ; ans = i ; } } System . out . println ( "2 ▁ 1 ▁ " + ans ) ; }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

import java . io . * ; import java . math . * ; import java . security . * ; import java . text . * ; import java . util . * ; import javafx . util . Pair ;   public class CodeForce {   static int [ ] dp = new int [ 2048 ] ;  	 	  public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] sr = br . readLine ( ) . split ( " ▁ " ) ;   float n = next ( sr , 0 ) ; float a = next ( sr , 1 ) ; if ( n == 3 ) { System . out . println ( "1 ▁ 2 ▁ 3" ) ; return ; } float angle = ( ( n - 2 ) * 180 ) / n ; if ( a > angle ) { System . out . println ( "1 ▁ 2 ▁ 3" ) ; return ; } float per_n = angle / ( n - 2 ) ; double close = Math . floor ( a / per_n ) ; if ( close == 0 ) { System . out . println ( "1 ▁ 2 ▁ " + ( int ) n ) ; return ; }   if ( Math . abs ( close * per_n - a ) < Math . abs ( ( close + 1 ) * per_n - a ) ) { System . out . println ( "1 ▁ 2 ▁ " + ( int ) ( n - ( int ) close + 1 ) ) ; } else System . out . println ( "1 ▁ 2 ▁ " + ( int ) ( n - ( int ) close ) ) ;   }   static int next ( String [ ] sr , int ind ) { return Integer . parseInt ( sr [ ind ] ) ; } }

import java . util . * ; import java . lang . * ; import java . math . * ; import java . awt . image . ConvolveOp ; import java . io . * ; import java . text . DecimalFormat ; import java . lang . Math ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; import java . util . * ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader sc = new FastReader ( ) ; static int pInf = Integer . MAX_VALUE ; static int nInf = Integer . MIN_VALUE ; public static void main ( String [ ] args ) { int test = 1 ;

import java . util . Scanner ;   public class B820 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; double alpha = Math . toRadians ( in . nextInt ( ) ) ; double minDiff = Double . POSITIVE_INFINITY ; int [ ] answer = null ;

n , m = map ( int , input ( ) . split ( ) ) x = 180 / n   y = int ( m / x )   z = y * x   w = ( y + 1 ) * x   if m - z <= w - m : v = yelse : v = y + 1 if v == 0 : v = 1 if 2 + v > n : print ( 2 , 1 , n ) else : print ( 2 , 1 , 2 + v ) NEW_LINE

n , a = map ( int , input ( ) . split ( ) ) ans = [ 2 , 1 , n ] d = abs ( 180 * ( n - 2 ) / n - a ) for i in range ( 3 , n ) : tmp = 180 * ( i - 2 ) / n if abs ( tmp - a ) < d : d = abs ( tmp - a ) ans [ 2 ] = i print ( ' ▁ ' . join ( map ( str , ans ) ) ) NEW_LINE

p , deg = [ int ( x ) for x in input ( ) . split ( ) ]   ang = 180 / pans = 420 v = 2 for i in range ( 2 , p ) : p_ang = ang * ( p - i ) if ans > abs ( p_ang - deg ) : v = i ans = abs ( p_ang - deg ) print ( p , 1 , v ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String arr [ ] [ ] = new String [ 8 ] [ 8 ] ; for ( int i = 0 ; i < 8 ; i ++ ) { String str = sc . nextLine ( ) ; arr [ i ] = str . split ( " " ) ; } boolean b = true ; for ( int i = 0 ; i < 8 ; i ++ ) { for ( int j = 1 ; j < 8 ; j ++ ) { if ( arr [ i ] [ j - 1 ] . equals ( arr [ i ] [ j ] ) ) { b = false ; break ; } } } System . out . println ( ( b ) ? " YES " : " NO " ) ; } }

import java . util . * ; import java . math . * ; import java . lang . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; String [ ] S = new String [ 8 ] ; boolean check = true ; for ( int i = 0 ; i < 8 ; i ++ ) { S [ i ] = sc . next ( ) ; for ( int j = 0 ; j < 7 ; j ++ ) { if ( S [ i ] . charAt ( j ) == S [ i ] . charAt ( j + 1 ) ) check = false ; } } if ( check ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) { FastReader scn = new FastReader ( ) ;

import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ;   import static java . lang . System . in ;   public class Chess { private static final int MOD = ( int ) ( 1E9 + 7 ) ; static FastReader scanner = new FastReader ( ) ;   public static void main ( String [ ] args ) throws IOException {

x = [ ] for i in range ( 8 ) : s = str ( input ( ) ) x . append ( s ) d = Falsefor i in range ( 8 ) : s = x [ i ] if ( s == " BWBWBWBW " or s == " WBWBWBWB " ) : continue else : d = True print ( " NO " ) breakif ( d == False ) : print ( " YES " )                 NEW_LINE

for _ in range ( 8 ) : string = input ( ) if " BB " in string : print ( " NO " ) break if " WW " in string : print ( " NO " ) breakelse : print ( " YES " ) NEW_LINE

def check_dub ( arr ) : for i in range ( len ( arr ) - 1 ) : if arr [ i ] == arr [ i + 1 ] : return ' NO ' return ' YES '   def solve ( arr ) : c = 0 first = arr [ 0 ] while c < 8 : if first [ 0 ] == ' W ' and first [ - 1 ] == ' B ' : break c += 1 first = first [ - 1 ] + first [ : - 1 ] if c == 8 : return ' NO ' arr [ 0 ] = first for i in arr : if check_dub ( i ) == ' NO ' : return ' NO ' return ' YES '           def main ( ) : NEW_LINE

def solve ( arr ) : for i in arr : if i not in [ ' WBWBWBWB ' , ' BWBWBWBW ' ] : return ' NO ' return ' YES '           def main ( ) : NEW_LINE


import java . util . Scanner ;   public class WorkFile { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; String s = scanner . next ( ) ; String t = scanner . next ( ) ; int n = s . length ( ) , m = t . length ( ) ; int [ ] [ ] dp = new int [ n + 1 ] [ m + 1 ] ; for ( int i = n - 1 ; i > - 1 ; i -- ) { for ( int j = m - 1 ; j > - 1 ; j -- ) { dp [ i ] [ j ] = dp [ i ] [ j + 1 ] ; if ( s . charAt ( i ) == t . charAt ( j ) ) { dp [ i ] [ j ] += dp [ i + 1 ] [ j + 1 ] + 1 ; dp [ i ] [ j ] %= 1000000007 ; } } } int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) { res += dp [ i ] [ 0 ] ; res %= 1000000007 ; } System . out . println ( res ) ; } }

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 ;

s = input ( ) . strip ( ) t = input ( ) . strip ( )   n , m = len ( s ) , len ( t ) mod = 10 ** 9 + 7   dp12 = [ [ 0 for i in range ( m ) ] for j in range ( n ) ] NEW_LINE

from sys import stdins = [ ord ( i ) - 97 for i in stdin . readline ( ) . strip ( ) ] s1 = [ ord ( i ) - 97 for i in stdin . readline ( ) . strip ( ) ] n = len ( s ) m = len ( s1 ) ans = 0 mod = 10 ** 9 + 7 dp = [ [ 0 for i in range ( n ) ] for j in range ( 26 ) ] for i in range ( m ) : arr = [ 0 for j in range ( n ) ] for j in range ( n ) : if s1 [ i ] == s [ j ] : arr [ j ] = 1 if j > 0 : arr [ j ] = ( arr [ j ] + dp [ s [ j - 1 ] ] [ j - 1 ] ) % mod for j in range ( n ) : dp [ s1 [ i ] ] [ j ] = ( arr [ j ] + dp [ s1 [ i ] ] [ j ] ) % mod x = 0 for i in dp : x = ( x + sum ( i ) ) % modprint ( x ) NEW_LINE

from sys import stdins = [ ord ( i ) - 97 for i in stdin . readline ( ) . strip ( ) ] s1 = [ ord ( i ) - 97 for i in stdin . readline ( ) . strip ( ) ] n = len ( s ) m = len ( s1 ) mod = 1000000007 dp = [ [ 0 for i in range ( n ) ] for j in range ( 26 ) ] for i in range ( m ) : arr = [ 0 for j in range ( n ) ] for j in range ( n ) : if s1 [ i ] == s [ j ] : arr [ j ] = 1 if j > 0 : arr [ j ] = ( arr [ j ] + dp [ s [ j - 1 ] ] [ j - 1 ] ) % mod for j in range ( n ) : dp [ s1 [ i ] ] [ j ] = ( arr [ j ] + dp [ s1 [ i ] ] [ j ] ) % mod x = 0 for i in dp : for j in i : x = ( x + j ) % modprint ( x ) NEW_LINE

import math     def newton ( n , k ) : return math . factorial ( n ) // ( math . factorial ( k ) * math . factorial ( n - k ) )     class CodeforcesTask163ASolution : def __init__ ( self ) : self . result = ' ' self . s = ' ' self . t = ' '   def read_input ( self ) : self . s = input ( ) self . t = input ( )   def process_task ( self ) : dp = [ [ 0 for x in range ( 5005 ) ] for y in range ( 5005 ) ] l1 = len ( self . s ) l2 = len ( self . t ) mod = 1_000_000_007 for x in range ( l1 ) : for y in range ( l2 ) : dp [ x + 1 ] [ y + 1 ] = dp [ x + 1 ] [ y ] % mod fact = 1 if self . s [ x ] == self . t [ y ] else 0 dp [ x + 1 ] [ y + 1 ] += ( fact * ( dp [ x ] [ y ] + 1 ) ) % mod result = 0 for x in range ( l1 ) : result = ( result + dp [ x + 1 ] [ l2 ] ) % mod self . result = str ( result )   def get_result ( self ) : return self . result     if __name__ == " _ _ main _ _ " : Solution = CodeforcesTask163ASolution ( ) Solution . read_input ( ) Solution . process_task ( ) print ( Solution . get_result ( ) ) NEW_LINE


import java . util . Scanner ;   public class PowerConsumptionCalculation { final static int MAX = 2000 ; public static void main ( String [ ] args ) { int n = 0 ; int d = 0 ; int [ ] arr = new int [ MAX ] ; int count = 0 ; Scanner scanner = new Scanner ( System . in ) ; n = scanner . nextInt ( ) ; d = scanner . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; }   for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] >= arr [ i + 1 ] ) { count += ( arr [ i ] - arr [ i + 1 ] ) / d + 1 ; arr [ i + 1 ] += ( ( arr [ i ] - arr [ i + 1 ] ) / d + 1 ) * d ; } } System . out . println ( count ) ;   } }

import java . util . Scanner ; public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int c [ ] = new int [ a ] ; for ( int i = 0 ; i < a ; i ++ ) { c [ i ] = sc . nextInt ( ) ; } int count = 0 ; for ( int i = 0 ; i < a - 1 ; i ++ ) { while ( c [ i ] == c [ i + 1 ] ) { c [ i + 1 ] = c [ i + 1 ] + b ; count ++ ; } while ( c [ i ] > c [ i + 1 ] ) { int d = ( c [ i ] - c [ i + 1 ] ) / b ; c [ i + 1 ] = c [ i + 1 ] + b * ( d + 1 ) ; count = count + d + 1 ; } } System . out . println ( count ) ; }   }

import java . io . * ; import java . util . Scanner ; public class code_11A { public static void main ( String args [ ] ) throws IOException { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int d = in . nextInt ( ) ; int x [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) x [ i ] = in . nextInt ( ) ; int i = 1 , c = 0 ; while ( i < n ) { if ( x [ i - 1 ] < x [ i ] ) i ++ ; else if ( x [ i ] <= x [ i - 1 ] ) { double z = ( double ) ( ( x [ i - 1 ] - x [ i ] ) / ( double ) d ) ; if ( z == 0.0 ) z = 1.0 ; c += ( int ) ( Math . ceil ( z ) ) ; x [ i ] += ( d * ( ( int ) ( Math . ceil ( z ) ) ) ) ; if ( x [ i ] == x [ i - 1 ] ) { c += 1 ; x [ i ] += d ; } i ++ ; } } System . out . println ( c ) ; } }

import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) , d = scan . nextInt ( ) ; int a [ ] = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) a [ i ] = scan . nextInt ( ) ; int ans = 0 ; for ( int i = 2 ; i <= n ; i ++ ) { if ( a [ i ] <= a [ i - 1 ] ) { ans += ( a [ i - 1 ] - a [ i ] ) / d + 1 ; a [ i ] += ( ( a [ i - 1 ] - a [ i ] ) / d + 1 ) * d ; } } System . out . print ( ans ) ; } }

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

''' Jana ▁ Goodman6 11A ▁ Increasing ▁ Sequence  ''' import mathSPACE = ' ▁ '   def min_moves ( n , d , b ) : result = 0 for i in range ( 0 , n - 1 ) : if b [ i + 1 ] <= b [ i ] : times = abs ( b [ i + 1 ] - b [ i ] ) // d + 1 b [ i + 1 ] += d * times result += times return result   if __name__ == ' _ _ main _ _ ' : n , d = map ( int , input ( ) . split ( SPACE ) ) b = list ( map ( int , input ( ) . split ( SPACE ) ) ) print ( min_moves ( n , d , b ) ) NEW_LINE

import mathn , d = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) answer = 0 for i in range ( 1 , len ( a ) ) : if ( a [ i ] <= a [ i - 1 ] ) : t = math . ceil ( ( a [ i - 1 ] - a [ i ] + 1 ) / d ) answer += t a [ i ] += t * dprint ( answer ) NEW_LINE

n , k = input ( ) . split ( ) n = int ( n ) k = int ( k ) li = [ ] p = input ( ) . split ( ) for i in p : li . append ( int ( i ) ) cnt = 0 for i in range ( 1 , n ) : if li [ i ] <= li [ i - 1 ] : p = ( li [ i - 1 ] - li [ i ] ) // k p = p + 1 cnt = cnt + p li [ i ] = li [ i ] + ( k * p ) print ( cnt ) NEW_LINE

n , d = map ( int , input ( ) . split ( ) ) arr = [ int ( i ) for i in input ( ) . split ( ) ] ans = 0 for i in range ( 1 , n ) : if arr [ i ] <= arr [ i - 1 ] : l , r = 0 , 10 ** 8 while ( r - l ) > 1 : mid = ( r + l ) // 2 k = mid * d if ( arr [ i ] + k ) > arr [ i - 1 ] : r = mid else : l = mid arr [ i ] += r * d ans += r print ( ans ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n , x ; n = sc . nextInt ( ) ; x = sc . nextInt ( ) ; int sum = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { sum += sc . nextInt ( ) ; }   sum = Math . abs ( sum ) ;   int cards = 0 ;   while ( sum > 0 ) { cards ++ ; sum -= x ; }   System . out . println ( cards ) ; } }

import java . util . * ; import java . math . * ; import java . lang . * ;   public class gfg { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += sc . nextInt ( ) ; sum = Math . abs ( sum ) ; int ans = sum / x ; if ( sum % x == 0 ) System . out . println ( ans ) ; else System . out . println ( ans + 1 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import java . util . TreeMap ;   public class Main implements Runnable { int n , m , k ; static boolean use_n_tests = false ;   void solve ( FastScanner in , PrintWriter out , int testNumber ) { n = in . nextInt ( ) ; int x = in . nextInt ( ) ; long sum = Math . abs ( Array . sum ( in . nextArray ( n ) ) ) ; out . println ( ( sum + x - 1 ) / x ) ; }

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

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += s . nextInt ( ) ; } int ans = Math . abs ( sum ) / k ; if ( Math . abs ( sum ) % k > 0 ) { ans ++ ; } System . out . println ( ans ) ; } }

from math import ceiln , x = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) print ( ceil ( abs ( sum ( l ) ) / x ) ) NEW_LINE

import sysfrom math import ceil   def main ( ) : _ , m , * l = map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) return int ( ceil ( abs ( sum ( l ) ) / m ) ) print ( main ( ) ) NEW_LINE

import mathn , x = map ( int , input ( ) . split ( ) ) l = [ ] c = 0 y = 0 list1 = [ ] l . extend ( map ( int , input ( ) . split ( ) ) ) sumy = sum ( l ) res = math . fabs ( sumy )   if res > x : while res > x : res -= x c += 1 else : c += 1 elif not res : print ( 0 ) else : print ( 1 ) if c : print ( c ) NEW_LINE

n , x = list ( map ( int , input ( ) . split ( ) ) ) val = abs ( sum ( list ( map ( int , input ( ) . split ( ) ) ) ) ) if val % x == 0 : print ( val // x ) else : print ( val // x + 1 ) NEW_LINE

import math     def main_function ( ) : n , x = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] cards = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] sum_negative = 0 sum_positive = 0 for i in cards : if i > 0 : sum_positive += i else : sum_negative += abs ( i ) dif = abs ( sum_negative - sum_positive ) cards = int ( math . ceil ( dif / x ) ) return cards             print ( main_function ( ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . text . * ; public class Main { static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int n = readInt ( ) , v = readInt ( ) , arr [ ] = new int [ n ] , arr1 [ ] = new int [ n ] , val = 0 ; double min = Double . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = readInt ( ) ; val += arr [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { arr1 [ i ] = readInt ( ) ; min = Math . min ( min , arr1 [ i ] / 1.0 / arr [ i ] ) ; } for ( double i = min ; i >= 0 ; i -= 0.00001 ) { double cur = i * val ; if ( cur <= v ) { System . out . println ( cur ) ; return ; } } } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( input . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } static long readLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static int readInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static double readDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static char readChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } static String readLine ( ) throws IOException { return input . readLine ( ) . trim ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   public class GuiltyKitchen { public static void main ( String [ ] args ) throws IOException { BufferedReader r = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String l = r . readLine ( ) ; String [ ] a = l . split ( " ▁ " ) ; int n = Integer . parseInt ( a [ 0 ] ) ; int v = Integer . parseInt ( a [ 1 ] ) ; l = r . readLine ( ) ; a = l . split ( " ▁ " ) ; float [ ] A = new float [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { A [ i ] = Float . parseFloat ( a [ i ] ) ; } l = r . readLine ( ) ; a = l . split ( " ▁ " ) ; float [ ] B = new float [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { B [ i ] = Float . parseFloat ( a [ i ] ) ; } float min = Float . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { min = Math . min ( B [ i ] / A [ i ] , min ) ; } float ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += A [ i ] * min ; } ans = Math . min ( ans , v ) ; System . out . println ( ans ) ; } }

import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . * ; public class cdfpc3c { static void merge ( int arr [ ] , int l , int m , int r ) { int n1 = m - l + 1 ; int n2 = r - m ; int L [ ] = new int [ n1 ] ; int R [ ] = new int [ n2 ] ; for ( int i = 0 ; i < n1 ; ++ i ) L [ i ] = arr [ l + i ] ; for ( int j = 0 ; j < n2 ; ++ j ) R [ j ] = arr [ m + 1 + j ] ; int i = 0 , j = 0 ; int k = l ; while ( i < n1 && j < n2 ) { if ( L [ i ] <= R [ j ] ) { arr [ k ] = L [ i ] ; i ++ ; } else { arr [ k ] = R [ j ] ; j ++ ; } k ++ ; } while ( i < n1 ) { arr [ k ] = L [ i ] ; i ++ ; k ++ ; } while ( j < n2 ) { arr [ k ] = R [ j ] ; j ++ ; k ++ ; } } static void sort ( int arr [ ] , int l , int r ) { if ( l < r ) { int m = ( l + r ) / 2 ; sort ( arr , l , m ) ; sort ( arr , m + 1 , r ) ; merge ( arr , l , m , r ) ; } } public static int lowerBound ( int [ ] array , int length , int value ) { int low = 0 ; int high = length ; while ( low < high ) { final int mid = ( low + high ) / 2 ;

import java . io . * ; import java . util . * ;   public class Main { static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter writer ;   static int nextInt ( ) throws IOException { return Integer . parseInt ( nextToken ( ) ) ; }   static long nextLong ( ) throws IOException { return Long . parseLong ( nextToken ( ) ) ; }   static double nextDouble ( ) throws IOException { return Double . parseDouble ( nextToken ( ) ) ; }   static String nextToken ( ) throws IOException { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } return tokenizer . nextToken ( ) ; } static String nexts ( ) throws IOException { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; String s = " " ; while ( tokenizer . hasMoreTokens ( ) ) { s += tokenizer . nextElement ( ) + " ▁ " ; } return s ; }

n , V = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) Sa = sum ( a ) m = min ( b ) res = 0 for i in range ( n ) : cur_r = 0 for j in range ( n ) : if ( b [ j ] >= a [ j ] * b [ i ] / a [ i ] ) : cur_r += a [ j ] * b [ i ] / a [ i ] else : break else : res = max ( cur_r , res ) print ( min ( res , float ( V ) ) ) NEW_LINE

n , v = map ( int , input ( ) . split ( ) ) ar = list ( map ( int , input ( ) . split ( ) ) ) br = list ( map ( int , input ( ) . split ( ) ) ) x = min ( [ br [ i ] / ar [ i ] for i in range ( n ) ] ) sm = min ( v , sum ( ar ) * x ) print ( sm ) NEW_LINE

n , v = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) ) r = min ( b [ i ] / a [ i ] * sum ( a ) for i in range ( n ) ) print ( min ( r , v ) ) NEW_LINE

n , V = input ( ) . split ( ) n , V = int ( n ) , int ( V ) a = list ( map ( int , input ( ) . split ( ) ) ) b = list ( map ( int , input ( ) . split ( ) ) )   ratio = 100000     for i in range ( n ) : ratio = min ( ratio , b [ i ] / a [ i ] ) suma = 0 for i in range ( n ) : suma += ratio * a [ i ]   print ( min ( V , suma ) )   NEW_LINE


import java . util . * ; import java . awt . Point ; import java . lang . Math ; import java . util . Arrays ; import java . util . Scanner ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . io . OutputStream ; import java . util . Comparator ; import java . math . BigInteger ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . util . stream . IntStream ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . StringTokenizer ; public class Main { public static void main ( String [ ] args ) { FastScanner in = new FastScanner ( ) ; OutputStream outputStream = System . out ; PrintWriter out = new PrintWriter ( outputStream ) ; int a [ ] [ ] = new int [ 26 ] [ 9 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { String S = in . n ( ) ; a [ S . charAt ( 1 ) - ' a ' ] [ S . charAt ( 0 ) - '1' ] ++ ; } int max = 0 ; for ( int c = 0 ; c < 26 ; c ++ ) { for ( int d = 0 ; d < 9 ; d ++ ) { max = Math . max ( max , a [ c ] [ d ] ) ; } } int minKoutsu = 3 - max ; max = 0 ; for ( int c = 0 ; c < 26 ; c ++ ) { for ( int d = 2 ; d < 9 ; d ++ ) { int count = 0 ; for ( int i = - 2 ; i <= 0 ; i ++ ) { if ( a [ c ] [ d + i ] > 0 ) { count ++ ; } } max = Math . max ( max , count ) ; } } int minShuntsu = 3 - max ; int answer = Math . min ( minKoutsu , minShuntsu ) ; System . out . println ( answer ) ; } private static int sumOfDigits ( int number ) { if ( number <= 0 ) return 0 ; int sum = 0 ; while ( number > 0 ) { sum += number % 10 ; number /= 10 ; } return sum ; } static void ruffle_sort ( int [ ] a ) {

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

import java . util . Arrays ; import java . util . Scanner ;   public class TokitsukazeMahjong { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; String s1 = in . next ( ) , s2 = in . next ( ) , s3 = in . next ( ) ; in . close ( ) ;   char c1 = s1 . charAt ( 1 ) , c2 = s2 . charAt ( 1 ) , c3 = s3 . charAt ( 1 ) ; int i1 = Integer . valueOf ( s1 . substring ( 0 , 1 ) ) , i2 = Integer . valueOf ( s2 . substring ( 0 , 1 ) ) , i3 = Integer . valueOf ( s3 . substring ( 0 , 1 ) ) , a [ ] = new int [ ] { i1 , i2 , i3 } ;   Arrays . sort ( a ) ; if ( s1 . equals ( s2 ) && s1 . equals ( s3 ) || ( a [ 2 ] - a [ 1 ] == 1 && a [ 1 ] - a [ 0 ] == 1 && c1 == c2 && c1 == c3 ) ) { System . out . println ( 0 ) ; } else if ( s1 . equals ( s2 ) || s1 . equals ( s3 ) || s2 . equals ( s3 ) || ( c1 == c2 && Math . abs ( i1 - i2 ) < 3 ) || ( c1 == c3 && Math . abs ( i1 - i3 ) < 3 ) || ( c2 == c3 && Math . abs ( i2 - i3 ) < 3 ) ) { System . out . println ( 1 ) ; } else { System . out . println ( 2 ) ; } } }

cards = list ( map ( str , input ( ) . split ( ) ) ) sArr = [ 0 ] * 9 mArr = [ 0 ] * 9 pArr = [ 0 ] * 9   for i in cards :   val = int ( i [ 0 ] )   if i [ 1 ] == ' s ' : sArr [ val - 1 ] += 1   elif i [ 1 ] == ' m ' :   mArr [ val - 1 ] += 1   else :   pArr [ val - 1 ] += 1     maxNum = max ( sArr , mArr , pArr ) maxNum = max ( maxNum )     if maxNum == 2 : print ( 1 ) elif maxNum == 3 : print ( 0 ) else : trio = 0 for i in range ( 7 ) : trio = max ( trio , sArr [ i ] + sArr [ i + 1 ] + sArr [ i + 2 ] )   for i in range ( 7 ) : trio = max ( trio , mArr [ i ] + mArr [ i + 1 ] + mArr [ i + 2 ] )   for i in range ( 7 ) : trio = max ( trio , pArr [ i ] + pArr [ i + 1 ] + pArr [ i + 2 ] )   print ( 3 - trio ) NEW_LINE

from sys import stdin , stdoutfrom math import floor , gcd , fabs , factorial , fmod , sqrt , inf , logfrom collections import defaultdict as dd , dequefrom heapq import merge , heapify , heappop , heappush , nsmallestfrom bisect import bisect_left as bl , bisect_right as br , bisect mod = pow ( 10 , 9 ) + 7 mod2 = 998244353 def inp ( ) : return stdin . readline ( ) . strip ( ) def out ( var , end = " \n " ) : stdout . write ( str ( var ) + " \n " ) def outa ( * var , end = " \n " ) : stdout . write ( ' ▁ ' . join ( map ( str , var ) ) + end ) def lmp ( ) : return list ( mp ( ) ) def mp ( ) : return map ( int , inp ( ) . split ( ) ) def smp ( ) : return map ( str , inp ( ) . split ( ) ) def l1d ( n , val = 0 ) : return [ val for i in range ( n ) ] def l2d ( n , m , val = 0 ) : return [ l1d ( m , val ) for j in range ( n ) ] def remadd ( x , y ) : return 1 if x % y else 0 def ceil ( a , b ) : return ( a + b - 1 ) // b def isprime ( x ) : if x <= 1 : return False if x in ( 2 , 3 ) : return True if x % 2 == 0 : return False for i in range ( 3 , int ( sqrt ( x ) ) + 1 , 2 ) : if x % i == 0 : return False return True ml = inp ( ) . split ( ) ans = len ( set ( ml ) ) - 1 for i in range ( 1 , 10 ) : for j in " psm " : k = 3 if str ( i ) + j in ml : k -= 1 if str ( i + 1 ) + j in ml : k -= 1 if str ( i + 2 ) + j in ml : k -= 1 ans = min ( ans , k ) print ( ans ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : cin = input d = { " m " : [ ] , " s " : [ ] , " p " : [ ] } mx = 2   for i in cin ( ) . split ( ) : d [ i [ 1 ] ] . append ( int ( i [ 0 ] ) ) for i in d . keys ( ) : b = sorted ( d [ i ] ) if 3 - len ( d [ i ] ) == 0 : b = [ b [ i ] - b [ i - 1 ] for i in range ( 1 , 3 ) ] if b [ 0 ] == b [ 1 ] == 0 or b [ 0 ] == b [ 1 ] == 1 : mx = 0 elif min ( b [ 0 ] , b [ 1 ] ) < 3 : mx = 1 else : mx = 2 break elif 3 - len ( d [ i ] ) == 1 : mx = 2 if b [ 1 ] - b [ 0 ] > 2 else 1 break else : mx = 2 print ( mx ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : cin = input d = { " m " : [ ] , " s " : [ ] , " p " : [ ] } mx = 2   for i in cin ( ) . split ( ) : d [ i [ 1 ] ] . append ( int ( i [ 0 ] ) ) for i in d . keys ( ) : b = sorted ( d [ i ] ) if 3 - len ( d [ i ] ) == 0 : b = [ b [ i ] - b [ i - 1 ] for i in range ( 1 , 3 ) ] mx = 0 if b [ 0 ] == b [ 1 ] and b [ 0 ] in ( 0 , 1 ) else 1 if min ( b [ 0 ] , b [ 1 ] ) < 3 else 2 break if 3 - len ( d [ i ] ) == 1 : mx = 2 if b [ 1 ] - b [ 0 ] > 2 else 1 break print ( mx ) NEW_LINE


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

import java . util . Scanner ;   public class Apple {   public static void main ( String args [ ] ) {   try {   Scanner sc = new Scanner ( System . in ) ;   String str [ ] = new String [ 2 ] ; str = sc . next ( ) . split ( " : " ) ;   double a = Integer . parseInt ( str [ 0 ] ) ; double b = Integer . parseInt ( str [ 1 ] ) ;   double min = b * 6 ;   double hr = a * 30 + b / 2 ; if ( hr >= 360.0 ) { hr = hr - 360 ; }   System . out . println ( hr + " ▁ " + min ) ;   } catch (   Exception e ) { return ;   } } }

import java . util . * ; import java . io . * ; public class Main { public static void main ( String args [ ] ) {   FastReader in = new FastReader ( ) ; PrintWriter so = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; String s = in . next ( ) ; int h = Integer . parseInt ( s . substring ( 0 , 2 ) ) ; int m = Integer . parseInt ( s . substring ( 3 , 5 ) ) ; h = ( h >= 12 ) ? h - 12 : h ; so . println ( ( h * 60 * 0.5 ) + ( m * 0.5 ) + " ▁ " + ( m * 60 * 0.1 ) ) ; so . flush ( ) ; } 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 ( ) ) ; }   int [ ] readIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long [ ] readLongArray ( int n ) { long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextLong ( ) ; return a ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s [ ] = scan . next ( ) . split ( " : " ) ; int h = Integer . parseInt ( s [ 0 ] ) ; int m = Integer . parseInt ( s [ 1 ] ) ; int nm = ( 6 * m ) ; double nh = ( 30 * h ) % 360 ; nh += 30 * m / 60.00 ; System . out . println ( nh + " ▁ " + nm ) ; } }

time = input ( ) NEW_LINE if int ( time [ 0 ] + time [ 1 ] ) >= 12 : newtime = str ( int ( time [ 0 ] + time [ 1 ] ) - 12 ) . zfill ( 2 ) + time [ 2 : ]   else : newtime = time   hour = int ( newtime [ 0 ] + newtime [ 1 ] ) NEW_LINE min = int ( newtime [ 3 ] + newtime [ 4 ] )   hourhand = 360 * ( hour / 12 ) + ( min / 60 ) * 30 NEW_LINE minhand = 360 * ( min / 60 )   print ( hourhand , minhand )   NEW_LINE

s = input ( ) NEW_LINE if s [ 0 ] == "0" : NEW_LINE INDENT h = int ( s [ 1 ] ) else : NEW_LINE h = int ( s [ : 2 ] ) NEW_LINE DEDENT if s [ 3 ] == "0" : NEW_LINE INDENT m = int ( s [ 4 ] ) else : NEW_LINE m = int ( s [ 3 : ] ) NEW_LINE DEDENT a = ( ( h ) * 30 + 6 * ( 5 * m / 60 ) ) % 360 NEW_LINE if str ( a ) [ - 1 ] == "0" : a = int ( a ) NEW_LINE b = 6 * mprint ( a , b ) NEW_LINE

h , m = map ( float , input ( ) . split ( " : " ) ) NEW_LINE if h > 12 : h -= 12 NEW_LINE rh = h * 30 NEW_LINE rh += m / 2 NEW_LINE rm = m * 6 NEW_LINE rh %= 360 NEW_LINE rm %= 360 NEW_LINE if int ( rh ) == rh : rh = int ( rh ) NEW_LINE if int ( rm ) == rm : rm = int ( rm ) NEW_LINE print ( ( rh ) , ( rm ) ) NEW_LINE

h , m = map ( int , input ( ) . split ( ' : ' ) ) NEW_LINE if ( h >= 12 ) : h -= 12 NEW_LINE print ( h * 30 + 30 * m / 60 , m * 6 ) NEW_LINE


import java . util . * ; public class HelloWorld {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( a [ n - 1 - i ] + " ▁ " ) ; System . out . println ( ) ; } } }

import java . util . Scanner ;   public class A1405 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; StringBuilder output = new StringBuilder ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int [ ] P = new int [ N ] ; for ( int n = 0 ; n < N ; n ++ ) { P [ n ] = in . nextInt ( ) ; } for ( int n = N - 1 ; n >= 0 ; n -- ) { output . append ( P [ n ] ) . append ( ' ▁ ' ) ; } output . append ( ' \n ' ) ; } System . out . print ( output ) ; }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . ArrayList ; import java . util . StringTokenizer ; public class B { 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 [ ] nextArray ( 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 ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) {

import java . util . * ;   public class PermutationF { public static void main ( String [ ] agrs ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = sc . nextInt ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) System . out . print ( a [ i ] + " ▁ " ) ; System . out . println ( ) ; } } }

t = int ( input ( ) ) NEW_LINE ans = [ ] NEW_LINE for i in range ( t ) : n = input ( ) NEW_LINE p = input ( ) . split ( ) NEW_LINE p . reverse ( ) NEW_LINE ans . append ( p ) NEW_LINE for j in ans : print ( " ▁ " . join ( j ) ) NEW_LINE

from collections import Countert = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE q = reversed ( ali ) NEW_LINE print ( * q ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( * arr [ : : - 1 ] ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : n = int ( input ( ) ) NEW_LINE a = [ int ( s ) for s in input ( ) . split ( " ▁ " ) ] NEW_LINE a . reverse ( ) NEW_LINE print ( " ▁ " . join ( map ( str , a ) ) ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int x = sc . nextInt ( ) ; a [ i ] = x ; }   int m = sc . nextInt ( ) ; int [ ] b = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { int x = sc . nextInt ( ) ; b [ i ] = x ; } Arrays . sort ( a ) ; Arrays . sort ( b ) ; System . out . println ( a [ a . length - 1 ] + " ▁ " + b [ b . length - 1 ] ) ; } }

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

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int arr [ ] = new int [ n ] ; int dp [ ] = new int [ 500 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = s . nextInt ( ) ; dp [ arr [ i ] ] ++ ; } int m = s . nextInt ( ) ; int bar [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { bar [ i ] = s . nextInt ( ) ; dp [ bar [ i ] ] ++ ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( dp [ bar [ j ] + arr [ i ] ] == 0 ) { System . out . println ( arr [ i ] + " ▁ " + bar [ j ] ) ; return ; } } } } }

import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int arr2 [ ] = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) arr2 [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; Arrays . sort ( arr2 ) ; System . out . println ( arr [ arr . length - 1 ] + " ▁ " + arr2 [ arr2 . length - 1 ] ) ; } }

import java . util . Scanner ;   public class A1206 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) , max1 = Integer . MIN_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int a = scanner . nextInt ( ) ; if ( a > max1 ) { max1 = a ; } } int m = scanner . nextInt ( ) , max2 = Integer . MIN_VALUE ; for ( int i = 0 ; i < m ; i ++ ) { int b = scanner . nextInt ( ) ; if ( b > max2 ) { max2 = b ; } } System . out . print ( max1 + " ▁ " + max2 ) ; } }

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( max ( a ) , max ( b ) ) NEW_LINE

a = int ( input ( ) ) b = map ( int , input ( ) . split ( ) ) c = int ( input ( ) ) d = map ( int , input ( ) . split ( ) ) print ( max ( b ) , max ( d ) ) NEW_LINE

print ( * ( max ( map ( int , input ( ) and input ( ) . split ( ) ) ) for _ in '00' ) ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   m = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) )   a . sort ( ) b . sort ( )   print ( str ( a [ len ( a ) - 1 ] ) + " ▁ " + str ( b [ len ( b ) - 1 ] ) ) NEW_LINE

n = input ( ) a = list ( map ( int , input ( ) . split ( ) ) ) m = input ( ) b = list ( map ( int , input ( ) . split ( ) ) ) print ( max ( a ) , max ( b ) ) NEW_LINE


import java . math . BigInteger ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . InputMismatchException ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; public class Main { static long l [ ] ; static int k ; static int cycle = 0 ; static InputReader rd = new InputReader ( System . in ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; long a [ ] = new long [ n ] ; long tot = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextLong ( ) ; tot += a [ i ] ; } Arrays . parallelSort ( a ) ; int sel = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] > sel ) sel ++ ; } long lc = a [ n - 1 ] - sel ; long rem = tot - lc - n ; System . out . println ( rem ) ; } static void findCycle ( ArrayList < Integer > adj [ ] , int v , int visited [ ] , boolean visitedc [ ] ) { visited [ v ] = 1 ; visitedc [ v ] = true ; for ( int i : adj [ v ] ) { if ( visited [ i ] == 1 ) {

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

''' input3 ▁ 33 ▁ 1 ▁ 1 '''   n , m = map ( int , input ( ) . split ( " ▁ " ) )   l = list ( map ( int , input ( ) . split ( " ▁ " ) ) )   l . sort ( ) prev = 0 req = 0   for i in range ( len ( l ) ) : req += 1   if l [ i ] > prev : prev += 1   req += l [ len ( l ) - 1 ] - prev NEW_LINE

n , h = map ( int , input ( ) . split ( ) ) lst = list ( map ( int , input ( ) . split ( ) ) ) lst . sort ( reverse = True ) ans = 0 for i in range ( 1 , n ) : if lst [ i - 1 ] == 1 : ans += lst [ i ] - 1 lst [ i ] = 1 else : if lst [ i - 1 ] <= lst [ i ] : ans += lst [ i ] - lst [ i - 1 ] + 1 lst [ i ] = lst [ i - 1 ] - 1 for i in range ( n - 1 ) : if lst [ i ] != lst [ i + 1 ] : ans += lst [ i + 1 ] print ( ans ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) a = [ int ( x ) for x in input ( ) . split ( ) ] a . sort ( ) j = 1 for i in a : if i >= j : j += 1 NEW_LINE


import java . util . Scanner ;   public class A865 {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int a = s . nextInt ( ) ; System . out . println ( " " + ( 2 * a - 1 ) + " ▁ 2" ) ; System . out . println ( "1 ▁ 2" ) ; } }

import java . io . * ; import java . util . * ; import java . util . regex . * ; public class vk18 { public static void main ( String [ ] stp ) throws Exception { Scanner scan = new Scanner ( System . in ) ; PrintWriter pw = new PrintWriter ( System . out ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int n = Integer . parseInt ( st . nextToken ( ) ) ; pw . println ( ( 2 * n - 1 ) + " ▁ 2" ) ; pw . write ( "1 ▁ 2" ) ; pw . flush ( ) ;   }   }

import java . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; public class B { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ;

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 = int ( input ( ) ) if n == 1 : print ( 1 , 1 ) print ( 1 ) else : print ( ( n - 1 ) * 2 , 2 ) print ( 1 , 2 ) NEW_LINE

n = int ( input ( ) ) a = 2 * n - 1 print ( a , 2 ) print ( 1 , 2 ) NEW_LINE

n = int ( input ( ) ) print ( max ( 1 , 2 * n - 2 ) , 2 ) print ( 1 , 2 ) NEW_LINE

import sys import math   def IO ( ) : sys . stdin = open ( " pyinput . txt " , ' r ' ) sys . stdout = open ( " pyoutput . txt " , ' w ' )   def GCD ( a , b ) : if ( b == 0 ) : return a else : return GCD ( b , a % b )   def LCM ( a , b ) : return a * ( b // GCD ( a , b ) )   def scan ( TYPE_1 , TYPE_2 = 0 ) : if ( TYPE_1 == int ) : return map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) elif ( TYPE_1 == float ) : return map ( float , sys . stdin . readline ( ) . strip ( ) . split ( ) ) elif ( TYPE_1 == list and TYPE_2 == float ) : return list ( map ( float , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) elif ( TYPE_1 == list and TYPE_2 == int ) : return list ( map ( int , sys . stdin . readline ( ) . strip ( ) . split ( ) ) ) elif ( TYPE_1 == str ) : return sys . stdin . readline ( ) . strip ( ) else : print ( " ERROR ! ! ! ! " )         def main ( ) : n = int ( scan ( str ) )   if ( n == 1 ) : print ( 1 , 1 ) print ( 1 ) return   print ( ( n - 1 ) * 2 , 2 ) print ( 1 , 2 ) 	   NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . LinkedHashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . * ; import java . util . stream . Collectors ;   public class absolute { public static int binary ( int n , int m , int k ) { int st = 0 , end = k , pos = - 1 ; while ( st <= end ) { int mid = st + ( end - st ) / 2 ;

import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ;     public class AccidentalVictory {   public static void main ( String [ ] args ) {   InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader sc = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Solver solver = new Solver ( ) ; int t = sc . nextInt ( ) ;

import java . io . * ; import java . util . * ; public class Main { static BufferedReader br ; static PrintWriter pr ; static int cin ( ) throws Exception { return Integer . valueOf ( br . readLine ( ) ) ; } static int [ ] split ( ) throws Exception { String [ ] cmd = br . readLine ( ) . split ( " ▁ " ) ; int [ ] ans = new int [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Integer . valueOf ( cmd [ i ] ) ; } return ans ; } static long [ ] splitL ( ) throws IOException { String [ ] cmd = br . readLine ( ) . split ( " ▁ " ) ; long [ ] ans = new long [ cmd . length ] ; for ( int i = 0 ; i < cmd . length ; i ++ ) { ans [ i ] = Long . valueOf ( cmd [ i ] ) ; } return ans ; } static int sum ( long n ) { int ans = 0 ; while ( n != 0 ) { ans = ans + ( int ) ( n % 10 ) ; n = n / 10 ; } return ans ; } static int gcd ( int x , int y ) { if ( x == 0 ) return y ; if ( y == 0 ) return x ; if ( x > y ) return gcd ( x % y , y ) ; else return gcd ( x , y % x ) ; } public static void main ( String [ ] args ) throws Exception {

import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int testCases = in . nextInt ( ) ; for ( int i = 0 ; i < testCases ; i ++ ) { long str = in . nextLong ( ) ; long intel = in . nextLong ( ) ; long exp = in . nextLong ( ) ; System . out . println ( possibilities ( str , intel , exp ) ) ; } }   public static long possibilities ( long str , long intel , long exp ) { if ( str + exp <= intel ) return 0 ; if ( intel >= str ) { exp -= intel - str + 1 ; str = intel + 1 ; } long difference = exp - intel + str ; long possibilities = ( long ) Math . min ( exp + 1 , difference / 2 + difference % 2 ) ; return possibilities ; } }

t = int ( input ( ) )   for _ in range ( t ) : s , i , e = map ( int , input ( ) . split ( ) ) minAddStr = max ( 0 , ( e + i - s + 2 ) // 2 ) print ( max ( e - minAddStr + 1 , 0 ) ) 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 ( ) from heapq import heappop , heappushfrom bisect import * from collections import deque , Counterfrom math import * from itertools import permutationsdx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE

for t in range ( int ( input ( ) ) ) : s , i , e = map ( int , input ( ) . split ( ) ) low = 0 high = e NEW_LINE

for t in range ( int ( input ( ) ) ) : s , i , e = map ( int , input ( ) . split ( ) ) low = 0 high = e low_pos = high_pos = e + 1 while low <= high : mid = low + ( high - low ) // 2 if mid + s > i + ( e - mid ) : low_pos = mid high = mid - 1 else : low = mid + 1 print ( high_pos - low_pos ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String s = br . readLine ( ) ; String str [ ] = s . split ( " ▁ " ) ; int n = Integer . parseInt ( str [ 0 ] ) ; int m = Integer . parseInt ( str [ 1 ] ) ; int i = Integer . parseInt ( str [ 2 ] ) ; int j = Integer . parseInt ( str [ 3 ] ) ; int a = Integer . parseInt ( str [ 4 ] ) ; int b = Integer . parseInt ( str [ 5 ] ) ; int ar1 [ ] = { 1 , n , n , 1 } ; int ar2 [ ] = { m , 1 , m , 1 } ; int min = - 1 ; for ( int l = 0 ; l < 4 ; l ++ ) { int temp1 = Math . abs ( ar1 [ l ] - i ) ; int temp2 = Math . abs ( ar2 [ l ] - j ) ; if ( temp1 % a != 0 || temp2 % b != 0 ) continue ; temp1 /= a ; temp2 /= b ; if ( temp1 % 2 != temp2 % 2 ) continue ; int d = Math . max ( temp1 , temp2 ) ; if ( min == - 1 || d < min ) min = d ; } if ( a + i > n && i - a <= 0 && min != 0 || b + j > m && j - b <= 0 && min != 0 ) System . out . println ( " Poor ▁ Inna ▁ and ▁ pony ! " ) ; else if ( min == - 1 ) System . out . println ( " Poor ▁ Inna ▁ and ▁ pony ! " ) ; else System . out . println ( min ) ; } }

import java . util . * ; import java . lang . * ; import java . io . * ;   public class Ideone { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int i = sc . nextInt ( ) ; int j = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; if ( ( i == 1 && j == m ) || ( i == 1 && j == 1 ) || ( i == n && j == 1 ) || ( i == n && j == m ) ) { System . out . println ( 0 ) ; return ; } int sol = Integer . MAX_VALUE ;

import java . util . Scanner ;   public class innaandPinky {   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int i = sc . nextInt ( ) ; int j = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int ans = Integer . MAX_VALUE ; ans = Math . min ( ans , sol ( 1 , 1 , i , j , a , b ) ) ; ans = Math . min ( ans , sol ( 1 , m , i , j , a , b ) ) ; ans = Math . min ( ans , sol ( n , 1 , i , j , a , b ) ) ; ans = Math . min ( ans , sol ( n , m , i , j , a , b ) ) ;   if ( ans == Integer . MAX_VALUE || ( ( i - a < 1 && i + a > n ) || ( j - b < 1 && j + b > m ) ) && ans != 0 ) { System . out . println ( " Poor ▁ Inna ▁ and ▁ pony ! " ) ; } else { System . out . println ( ans ) ; } }   private static int sol ( int n , int m , int i , int j , int a , int b ) { if ( i == n && m == j ) return 0 ; int x = Math . abs ( n - i ) ; int y = Math . abs ( m - j ) ;   if ( x % a == 0 && y % b == 0 ) { if ( ( x / a ) % 2 == ( y / b ) % 2 ) { x = x / a ; y = y / b ; return Math . max ( x , y ) ; } } return Integer . MAX_VALUE ; } }

def fun ( x , y ) : if abs ( x - i ) % a == 0 and abs ( y - j ) % b == 0 and ( abs ( x - i ) // a - abs ( y - j ) // b ) % 2 == 0 : return max ( abs ( x - i ) // a , abs ( y - j ) // b ) return 1000000000 n , m , i , j , a , b = map ( int , input ( ) . split ( ) ) ans = min ( fun ( 1 , 1 ) , fun ( n , m ) , fun ( 1 , m ) , fun ( n , 1 ) ) NEW_LINE

n , m , i , j , a , b = map ( int , input ( ) . split ( ) ) corners = [ ( 1 , 1 ) , ( 1 , m ) , ( n , 1 ) , ( n , m ) ] result = Falseans = - 1 for cnt in corners : if ( abs ( cnt [ 0 ] - i ) % a == 0 ) and ( abs ( cnt [ 1 ] - j ) % b == 0 ) : result = True t1 , t2 = abs ( cnt [ 0 ] - i ) // a , abs ( cnt [ 1 ] - j ) // b if ( t1 + t2 ) % 2 == 0 : if ans == - 1 : ans = max ( abs ( cnt [ 0 ] - i ) // a , abs ( cnt [ 1 ] - j ) // b ) else : ans = min ( max ( abs ( cnt [ 0 ] - i ) // a , abs ( cnt [ 1 ] - j ) // b ) , ans ) if ans == 0 : print ( ans ) elif not result or ( i + a > n and i - a < 1 ) or ( j + b > m and j - b < 1 ) or ans == - 1 : print ( " Poor ▁ Inna ▁ and ▁ pony ! " ) else : print ( ans ) NEW_LINE

n , m , i , j , a , b = map ( int , input ( ) . split ( ) ) l = [ ] if ( i - 1 ) % a == 0 and ( j - 1 ) % b == 0 : s1 = ( i - 1 ) // a s2 = ( j - 1 ) // b if ( s1 + s2 ) % 2 == 0 : l . append ( max ( s1 , s2 ) ) if ( i - 1 ) % a == 0 and ( m - j ) % b == 0 : s1 = ( i - 1 ) // a s2 = ( m - j ) // b if ( s1 + s2 ) % 2 == 0 : l . append ( max ( s1 , s2 ) ) if ( n - i ) % a == 0 and ( j - 1 ) % b == 0 : s1 = ( n - i ) // a s2 = ( j - 1 ) // b if ( s1 + s2 ) % 2 == 0 : l . append ( max ( s1 , s2 ) ) if ( n - i ) % a == 0 and ( m - j ) % b == 0 : s1 = ( n - i ) // a s2 = ( m - j ) // b if ( s1 + s2 ) % 2 == 0 : l . append ( max ( s1 , s2 ) ) if ( i , j ) == ( 0 , 0 ) or ( i , j ) == ( n , m ) or ( i , j ) == ( n , 1 ) or ( i , j ) == ( 1 , m ) : print ( 0 ) elif i + a > n and i - a < 1 : print ( " Poor ▁ Inna ▁ and ▁ pony ! " ) elif j + b > m and j - b < 1 : print ( " Poor ▁ Inna ▁ and ▁ pony ! " ) elif len ( l ) == 0 : print ( " Poor ▁ Inna ▁ and ▁ pony ! " ) else : print ( min ( l ) ) NEW_LINE

n , m , ix , jy , a , b = list ( map ( int , input ( ) . rstrip ( ) . split ( ) ) )   def check ( x , y ) : ax = abs ( x - ix ) by = abs ( y - jy ) q1 = ax / a q2 = by / b if q2 == int ( q2 ) and q1 == int ( q1 ) : maxm = max ( int ( q1 ) , int ( q2 ) ) minm = min ( int ( q1 ) , int ( q2 ) ) NEW_LINE


import java . util . * ;   public class Supermarket {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; double min = Double . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { double a = scan . nextDouble ( ) ; double b = scan . nextDouble ( ) ; min = Math . min ( min , a / b ) ; } System . out . println ( min * m ) ; } }

import java . util . Scanner ;   public class Supermarket {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ;   int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; double ans = Double . MAX_VALUE ; while ( n -- > 0 ) { int a = input . nextInt ( ) ; int b = input . nextInt ( ) ; ans = Math . min ( ans , ( double ) a / b * ( m ) ) ; } System . out . printf ( " % .8f " , ans ) ; System . out . println ( " ▁ " ) ; }   }

import java . util . Scanner ;   public class Supermarket { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , m = in . nextInt ( ) ; double c = Double . POSITIVE_INFINITY ;   while ( n -- > 0 ) { double a = in . nextDouble ( ) , b = in . nextDouble ( ) ; if ( a / b < c ) { c = a / b ; } } in . close ( ) ; System . out . println ( c * m ) ; } }

import java . util . * ; import java . io . * ;   public class Supermarket {   public static void main ( String [ ] args ) {   FastScanner fs = new FastScanner ( ) ; final double PI = 3.141593 ; int num = fs . nextInt ( ) ; int m = fs . nextInt ( ) ; double ans = 999999999.99 ; for ( int i = 0 ; i < num ; i ++ ) { int a = fs . nextInt ( ) ; int b = fs . nextInt ( ) ; ans = Math . min ( ans , ( double ) ( a * m ) / b ) ; } System . out . println ( ans ) ; }   static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   public String next ( ) { while ( ! st . hasMoreElements ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = nextInt ( ) ; } return a ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } } }

n , m = map ( int , input ( ) . split ( ) ) l = [ ] for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) l . append ( m * ( a / b ) ) print ( min ( l ) ) NEW_LINE

import sys   def main ( ) : inp = sys . stdin . read ( ) . strip ( ) . split ( ' \n ' ) n , m = map ( int , inp [ 0 ] . split ( ) ) t = [ ] for s in inp [ 1 : ] : a , b = map ( int , s . split ( ) ) t . append ( a / b * m ) return min ( t ) print ( main ( ) ) NEW_LINE

import sys n , m = map ( int , input ( ) . split ( ) ) k = sys . maxsizefor _ in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) k = min ( k , x / y ) print ( round ( m * k , 8 ) ) NEW_LINE

import math   def main_function ( ) : output_list = [ ] n , m = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] for i in range ( n ) : a , b = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] output_list . append ( ( a / b ) * m ) return min ( output_list )               print ( main_function ( ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ; import static java . util . Arrays . sort ; import javafx . util . Pair ;   public class Main {   public static void main ( String [ ] args ) {   FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; int k = input . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; } if ( n <= k ) { System . out . println ( a [ n - 1 ] ) ; } else { int i = 0 ; int j = n - ( k * 2 - n ) - 1 ; int max = Integer . MIN_VALUE ; while ( i <= j ) { max = Math . max ( max , a [ i ] + a [ j ] ) ; i ++ ; j -- ; } max = Math . max ( max , a [ a . length - 1 ] ) ; System . out . println ( max ) ; }   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

import java . util . Scanner ;   public class BoxPacking { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; int k = scanner . nextInt ( ) ;   Integer [ ] size = new Integer [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) size [ i ] = scanner . nextInt ( ) ;   int max = size [ n - 1 ] ;   if ( n > k ) { int last = 2 * ( n - k ) - 1 ; for ( int i = 0 ; i <= last ; i ++ ) { max = Math . max ( max , size [ i ] + size [ last - i ] ) ; } } System . out . println ( max ) ; } }

import java . util . * ; import java . io . * ; import java . math . * ; public class Code {   static BufferedReader input = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String [ ] args ) throws IOException { int n = readInt ( ) , k = readInt ( ) , arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = readInt ( ) ; } Arrays . sort ( arr ) ; int boxes = ( n - k ) * 2 ; ArrayList < Integer > s = new ArrayList ( ) ; int ans = arr [ n - 1 ] ; for ( int i = 0 ; i < boxes ; i ++ ) { s . add ( arr [ i ] ) ; } int left = 0 , right = s . size ( ) - 1 ; while ( left < right ) { ans = Math . max ( ans , s . get ( left ) + s . get ( right ) ) ; left ++ ; right -- ; } println ( ans ) ; } static String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( input . readLine ( ) . trim ( ) ) ; return st . nextToken ( ) ; } static long readLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; } static int readInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; } static double readDouble ( ) throws IOException { return Double . parseDouble ( next ( ) ) ; } static char readChar ( ) throws IOException { return next ( ) . charAt ( 0 ) ; } static String readLine ( ) throws IOException { return input . readLine ( ) . trim ( ) ; } static void print ( Object b ) { System . out . print ( b ) ; } static void println ( Object b ) { System . out . println ( b ) ; } static void println ( ) { System . out . println ( ) ; } }

import java . util . * ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int [ ] a = new int [ n ] ; int size = 0 ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; size = Math . max ( size , a [ i ] ) ; } for ( int i = 0 ; i < n - x ; i ++ ) { size = Math . max ( size , a [ i ] + a [ 2 * ( n - x ) - 1 - i ] ) ; } System . out . println ( size ) ; } }

n , k = map ( int , input ( ) . split ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) Max = A [ - 1 ] while 2 * k > len ( A ) and A != [ ] : del A [ - 1 ] k -= 1 while A != [ ] : Max = max ( Max , A [ 0 ] + A [ - 1 ] ) del A [ 0 ] , A [ - 1 ] print ( Max ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) if k >= n : print ( max ( a ) ) else : i = n - 1 ans = 0 for j in range ( 2 * k - n ) : ans = max ( ans , a [ i ] ) i -= 1 start = 0 while start < i : ans = max ( ans , a [ i ] + a [ start ] ) i -= 1 start += 1 print ( ans ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) [ : : - 1 ] high = arr [ 0 ] for i in range ( k , n ) : high = max ( high , arr [ i ] + arr [ 2 * k - i - 1 ] ) print ( high ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


import java . io . BufferedInputStream ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; 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 . StringTokenizer ;   public class Main { public static void main ( String [ ] args ) throws FileNotFoundException , IOException { InputReader in = new InputReader ( new BufferedInputStream ( System . in ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( new BufferedOutputStream ( System . out ) ) ) ; TaskB solver = new TaskB ( ) ; long t1 = System . currentTimeMillis ( ) ; solver . solve ( 1 , in , out ) ; out . flush ( ) ; long t2 = System . currentTimeMillis ( ) ;

""" ▁ A ▁ : ▁ Determine ▁ if ▁ three ▁ line ▁ segments ▁ form ▁ A ▁ """     def cross ( vecA , vecB ) : return vecA [ 0 ] * vecB [ 1 ] - vecA [ 1 ] * vecB [ 0 ]     def dot ( vecA , vecB ) : return vecA [ 0 ] * vecB [ 0 ] + vecA [ 1 ] * vecB [ 1 ]     def angle ( lineA , lineB ) : x1 , y1 = ( lineA [ 0 ] [ 0 ] - lineA [ 1 ] [ 0 ] , lineA [ 0 ] [ 1 ] - lineA [ 1 ] [ 1 ] ) x2 , y2 = ( lineB [ 0 ] [ 0 ] - lineB [ 1 ] [ 0 ] , lineB [ 0 ] [ 1 ] - lineB [ 1 ] [ 1 ] ) d1 = ( x1 ** 2 + y1 ** 2 ) ** 0.5 d2 = ( x2 ** 2 + y2 ** 2 ) ** 0.5 return ( x1 * x2 + y1 * y2 ) / ( d1 * d2 )     def div_ratio ( line , point ) : NEW_LINE