import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class FootBallFouls { public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   String h = reader . readLine ( ) ; String a = reader . readLine ( ) ; int n = Integer . parseInt ( reader . readLine ( ) ) ;   int [ ] [ ] store = new int [ 2 ] [ 100 ] ;   for ( int i = 0 ; i < n ; i ++ ) { StringTokenizer st = new StringTokenizer ( reader . readLine ( ) ) ;   int minute = Integer . parseInt ( st . nextToken ( ) ) ;   int k = 0 ; if ( st . nextToken ( ) . equals ( " a " ) ) k = 1 ;   int player = Integer . parseInt ( st . nextToken ( ) ) ;   if ( st . nextToken ( ) . equals ( " y " ) ) store [ k ] [ player ] ++ ; else if ( store [ k ] [ player ] < 2 ) { store [ k ] [ player ] = 1000 ; System . out . println ( ( k == 0 ? h : a ) + " ▁ " + player + " ▁ " + minute ) ; }   if ( store [ k ] [ player ] == 2 ) { store [ k ] [ player ] = 1000 ; System . out . println ( ( k == 0 ? h : a ) + " ▁ " + player + " ▁ " + minute ) ; } } } }

import java . math . BigInteger ; import java . util . * ;   public class Main {   static Scanner input = new Scanner ( System . in ) ;   public static void main ( String [ ] args ) { String h [ ] = new String [ 2 ] ; h [ 0 ] = input . next ( ) ; h [ 1 ] = input . next ( ) ; int homecards [ ] = new int [ 100 ] ; int awaycards [ ] = new int [ 100 ] ; int redcards [ ] [ ] = new int [ 100 ] [ 3 ] ; int n = input . nextInt ( ) ; int ri = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int minute = input . nextInt ( ) ; String TeamName = input . next ( ) ; int Number = input . nextInt ( ) ; String color = input . next ( ) ; if ( TeamName . equals ( " h " ) && homecards [ Number ] != 2 ) { if ( color . equals ( " y " ) ) homecards [ Number ] ++ ; else homecards [ Number ] = 2 ; if ( homecards [ Number ] == 2 ) { redcards [ ri ] [ 0 ] = 0 ; redcards [ ri ] [ 1 ] = Number ; redcards [ ri ] [ 2 ] = minute ; ri ++ ; } } else if ( TeamName . equals ( " a " ) && awaycards [ Number ] != 2 ) { if ( color . equals ( " y " ) ) awaycards [ Number ] ++ ; else awaycards [ Number ] = 2 ; if ( awaycards [ Number ] == 2 ) { redcards [ ri ] [ 0 ] = 1 ; redcards [ ri ] [ 1 ] = Number ; redcards [ ri ] [ 2 ] = minute ; ri ++ ; } } } for ( int i = 0 ; i < ri ; i ++ ) { System . out . println ( h [ redcards [ i ] [ 0 ] ] + " ▁ " + redcards [ i ] [ 1 ] + " ▁ " + redcards [ i ] [ 2 ] ) ; } }      }

if __name__ == ' _ _ main _ _ ' : h , a = input ( ) , input ( ) s = lambda x , n , m : " % s ▁ % s ▁ % s " % ( x , n , m ) t = int ( input ( ) ) b , c = dict ( ) , dict ( )   def is_red ( d , key , name , m , func ) : if d [ key ] in ( 2 , 3 ) : print ( func ( name , key , m ) )   while t > 0 : d = input ( ) . split ( ) cnt = 1 if d [ 3 ] == " y " else 2 if d [ 1 ] == " h " : if b . get ( d [ 2 ] , 0 ) < 2 and 1 < b . get ( d [ 2 ] , 0 ) + cnt < 4 : print ( s ( h , d [ 2 ] , d [ 0 ] ) ) b [ d [ 2 ] ] = b . get ( d [ 2 ] , 0 ) + cnt else : if c . get ( d [ 2 ] , 0 ) < 2 and 1 < c . get ( d [ 2 ] , 0 ) + cnt < 4 : print ( s ( a , d [ 2 ] , d [ 0 ] ) ) c [ d [ 2 ] ] = c . get ( d [ 2 ] , 0 ) + cnt t -= 1 NEW_LINE

team_1 = input ( ) team_2 = input ( ) n = int ( input ( ) ) ll = [ ] for i in range ( n ) : mi , te , num , card = map ( str , input ( ) . split ( ) ) ll . append ( ( int ( mi ) , te , int ( num ) , card ) ) ll . sort ( key = lambda x : x [ 0 ] )   team_1_p = [ 0 for x in range ( 101 ) ] team_2_p = [ 0 for x in range ( 101 ) ] d_1 , d_2 = { } , { } sol = [ ] for l in ll : if l [ 1 ] == ' h ' : if l [ 3 ] == ' r ' : if l [ 2 ] not in d_1 : sol . append ( ( team_1 , l [ 2 ] , l [ 0 ] ) ) d_1 [ l [ 2 ] ] = True elif l [ 3 ] == ' y ' : if team_1_p [ l [ 2 ] ] == 0 : team_1_p [ l [ 2 ] ] += 1 else : if l [ 2 ] not in d_1 : sol . append ( ( team_1 , l [ 2 ] , l [ 0 ] ) ) d_1 [ l [ 2 ] ] = True if l [ 1 ] == ' a ' : if l [ 3 ] == ' r ' : if l [ 2 ] not in d_2 : sol . append ( ( team_2 , l [ 2 ] , l [ 0 ] ) ) d_2 [ l [ 2 ] ] = True elif l [ 3 ] == ' y ' : if team_2_p [ l [ 2 ] ] == 0 : team_2_p [ l [ 2 ] ] += 1 else : if l [ 2 ] not in d_2 : sol . append ( ( team_2 , l [ 2 ] , l [ 0 ] ) ) d_2 [ l [ 2 ] ] = True   for x in sol : print ( * x ) NEW_LINE

from math import * t1 = input ( ) t2 = input ( ) m1 , m2 = { } , { } for i in range ( int ( input ( ) ) ) : t , time , n , cor = input ( ) . split ( ) n = int ( n ) if ( time == ' h ' and ( n not in m1 or m1 [ n ] != ' r ' ) ) or ( time == ' a ' and ( n not in m2 or m2 [ n ] != ' r ' ) ) : if ( time == ' h ' and ( n in m1 and m1 [ n ] == ' y ' or cor == ' r ' ) ) or ( time == ' a ' and ( n in m2 and m2 [ n ] == ' y ' or cor == ' r ' ) ) : if time == " h " : m1 [ n ] = ' r ' else : m2 [ n ] = ' r ' print ( ( t1 if time == ' h ' else t2 ) , n , t ) else : if time == " h " : m1 [ n ] = ' y ' else : m2 [ n ] = ' y ' NEW_LINE

from collections import *   home = input ( ) away = input ( ) n = int ( input ( ) ) hd = defaultdict ( int ) ad = defaultdict ( int ) for i in range ( n ) : a = list ( map ( str , input ( ) . split ( ) ) ) if a [ 1 ] == " h " : if hd [ a [ 2 ] ] != - 1 : if a [ - 1 ] == " r " : hd [ a [ 2 ] ] = - 1 print ( home , a [ 2 ] , a [ 0 ] ) else : hd [ a [ 2 ] ] += 1 if hd [ a [ 2 ] ] == 2 : hd [ a [ 2 ] ] = - 1 print ( home , a [ 2 ] , a [ 0 ] ) else : if ad [ a [ 2 ] ] != - 1 : if a [ - 1 ] == " r " : ad [ a [ 2 ] ] = - 1 print ( away , a [ 2 ] , a [ 0 ] ) else : ad [ a [ 2 ] ] += 1 if ad [ a [ 2 ] ] == 2 : ad [ a [ 2 ] ] = - 1 print ( away , a [ 2 ] , a [ 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 ( ) import stringimport sysfrom heapq import heappop , heappushfrom bisect import * from collections import deque , Counter , defaultdictfrom math import * from itertools import permutations , accumulatedx = [ - 1 , 1 , 0 , 0 ] dy = [ 0 , 0 , 1 , - 1 ] NEW_LINE


import java . util . * ; public class sheets { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . next ( ) ; int n = sc . nextInt ( ) ; int low = 0 ; int high = 100000 ; TreeMap < Character , Integer > map = new TreeMap < > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { map . put ( s . charAt ( i ) , map . getOrDefault ( s . charAt ( i ) , 0 ) + 1 ) ; } int size = map . size ( ) ; if ( n < size ) { System . out . println ( " - 1" ) ; return ; } while ( low < high ) { int mid = ( low + high ) / 2 ; int sum = 0 ; for ( Map . Entry < Character , Integer > entry : map . entrySet ( ) ) { sum += Math . ceil ( ( double ) entry . getValue ( ) / mid ) ; } if ( sum > n ) { low = mid + 1 ; } else { high = mid ; } } System . out . println ( high ) ; String ans = " " ; for ( Map . Entry < Character , Integer > entry : map . entrySet ( ) ) { char [ ] t = new char [ ( int ) Math . ceil ( ( double ) entry . getValue ( ) / high ) ] ; Arrays . fill ( t , entry . getKey ( ) ) ; String k = new String ( t ) ; ans += k ; } if ( ans . length ( ) < n ) { while ( ans . length ( ) < n ) { ans = ans + " a " ; } } System . out . println ( ans ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class CF335A { static final int CHARS = 26 ;   public static void main ( String [ ] args ) throws IOException { FastScanner sc = new FastScanner ( ) ; PrintWriter pw = new PrintWriter ( System . out ) ;   char [ ] s = sc . nextToken ( ) . toCharArray ( ) ; int n = sc . nextInt ( ) ;   int [ ] occs = new int [ CHARS ] ; int distinct = 0 ; for ( char ch : s ) { if ( occs [ ch - ' a ' ] == 0 ) distinct ++ ; occs [ ch - ' a ' ] ++ ; } if ( distinct > n ) { pw . println ( - 1 ) ; pw . flush ( ) ; return ; }   int lo = 1 , hi = 1000 ; while ( lo <= hi ) { int mid = ( lo + hi ) / 2 ; int n1 = 0 ; for ( int occ : occs ) if ( occ > 0 ) n1 += ( occ + mid - 1 ) / mid ;

s = input ( ) n = int ( input ( ) ) d = { } r = 0 for a in s : d . setdefault ( a , 0 ) d [ a ] += 1 if ( d [ a ] > r ) : r = d [ a ] if ( len ( d ) > n ) : print ( - 1 ) else : l = 0 while r - l > 1 : k = ( l + r ) // 2 cur = 0 for x in d . values ( ) : cur += ( x + k - 1 ) // k if cur > n : l = k else : r = k print ( r ) s = ' ' for a in d . keys ( ) : s += a * ( ( d [ a ] + r - 1 ) // r ) l = len ( s ) s += ' a ' * ( n - len ( s ) ) print ( s ) NEW_LINE

from collections import Counter     def main ( ) : s = input ( ) l = int ( input ( ) ) d = Counter ( s ) if len ( d ) > l : print ( - 1 ) return lo = 0 hi = 10000 while lo + 1 < hi : mid = ( lo + hi ) // 2 c = 0 for x in iter ( d . values ( ) ) : c += ( x + mid - 1 ) // mid if c > l : lo = mid else : hi = mid print ( hi ) ans = [ ] for x in iter ( d . items ( ) ) : ans . append ( x [ 0 ] * int ( ( ( x [ 1 ] + hi - 1 ) / hi ) ) ) t = ' ' . join ( ans ) if len ( t ) < l : t += ' a ' * ( l - len ( t ) ) print ( t )     main ( ) NEW_LINE

from collections import defaultdict   s = input ( ) n = int ( input ( ) )   if len ( set ( s ) ) > n : print ( - 1 ) else : hist = defaultdict ( int ) for c in s : hist [ c ] += 1 for ans in range ( 1 , 2000 ) : cur_need = 0 for c in hist : NEW_LINE

s , n , q , a = input ( ) , int ( input ( ) ) , { } , " " for i in s : q [ i ] = [ q [ i ] [ 0 ] + 1 , 1 ] if i in q else [ 1 , 1 ] if len ( q ) > n : print ( - 1 ) else : for i in range ( n - len ( q ) ) : o = 0 for j in q : m = ( q [ j ] [ 0 ] + q [ j ] [ 1 ] - 1 ) // q [ j ] [ 1 ] if m > o : o , w = m , j q [ w ] [ 1 ] = q [ w ] [ 1 ] + 1 for i in q : a += i * q [ i ] [ 1 ] o = 0 for i in q : m = ( q [ i ] [ 0 ] + q [ i ] [ 1 ] - 1 ) // q [ i ] [ 1 ] if m > o : o = m print ( o , " \n " , a ) NEW_LINE


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

import java . util . Scanner ;   public class B1478 {   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 Q = in . nextInt ( ) ; int D = in . nextInt ( ) ; boolean [ ] possible = new boolean [ 100 ] ; possible [ 0 ] = true ; for ( int n = 1 ; n < 100 ; n ++ ) { if ( isLucky ( n , D ) ) { for ( int i = 0 ; i < 100 - n ; i ++ ) { if ( possible [ i ] ) { possible [ i + n ] = true ; } } } } for ( int q = 0 ; q < Q ; q ++ ) { int a = in . nextInt ( ) ; if ( a >= 100 ) { output . append ( " YES " ) ; } else { output . append ( possible [ a ] ? " YES " : " NO " ) ; } output . append ( ' \n ' ) ; } } System . out . print ( output ) ; }   static boolean isLucky ( int N , int D ) { while ( N > 0 ) { if ( N % 10 == D ) { return true ; } N /= 10 ; } return false ; }   }

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : q , d = map ( int , input ( ) . split ( ) ) NEW_LINE ali = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for j in ali : while NEW_LINE str ( d ) not in str ( j ) : NEW_LINE if ( j < 0 ) : NEW_LINE INDENT break else : NEW_LINE j -= d NEW_LINE DEDENT

t = int ( input ( ) ) NEW_LINE for i in range ( t ) : q , d = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE s = str ( d ) NEW_LINE l = [ 0 for j in range ( d * 10 - 1 ) ] NEW_LINE for j in range ( d * 10 - 1 ) : if NEW_LINE str ( j + 1 ) . count ( s ) : l [ j ] = 1 else : for k in range ( 0 , j ) : if NEW_LINE l [ k ] : NEW_LINE if str ( j - k ) . count ( s ) : l [ j ] = 1 NEW_LINE break NEW_LINE m = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in m : if NEW_LINE i >= d * 10 : print ( " YES " ) elif l [ i - 1 ] : print ( " YES " ) else : print ( " NO " ) NEW_LINE

t = int ( input ( ) ) NEW_LINE for _ in range ( t ) : q , d = map ( int , input ( ) . split ( ) ) NEW_LINE arr = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE for i in arr : if NEW_LINE str ( d ) in str ( i ) : print ( " YES " ) NEW_LINE continue NEW_LINE if i >= 10 * d or i % d == 0 : print ( " YES " ) NEW_LINE continue NEW_LINE temp = i NEW_LINE while temp > 0 : if NEW_LINE str ( d ) in str ( temp ) : print ( " YES " ) NEW_LINE break else : temp -= d NEW_LINE continue NEW_LINE if temp <= 0 : print ( " NO " )                                                                                NEW_LINE

import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase     NEW_LINE def main ( ) : import bisect NEW_LINE import NEW_LINE INDENT math   NEW_LINE DEDENT


import java . util . Scanner ;   public class CommandLineArguments {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; String s = sc . nextLine ( ) ; boolean quote = false ; boolean closed = true ; int cur = 0 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == ' " ' ) { if ( ! quote ) { quote = true ; sb . append ( ' < ' ) ; cur = 1 ; closed = false ; } else { sb . append ( " > \n " ) ; cur = 0 ; quote = false ; closed = true ; } } else if ( c == ' ▁ ' ) { if ( quote ) { sb . append ( c ) ; } else { if ( cur > 0 ) { sb . append ( " > \n " ) ; cur = 0 ; closed = true ; } else { } } } else { if ( cur == 0 ) sb . append ( ' < ' ) ; closed = false ; sb . append ( c ) ; cur ++ ; } } if ( ! closed ) sb . append ( ' > ' ) ; System . out . println ( sb ) ;    }   }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class CommandLineArguments {

import java . util . ArrayList ; import java . util . Scanner ;   public class P291B {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; String command = s . nextLine ( ) + " ▁ " ; ArrayList < String > lexemes = new ArrayList < > ( ) ; StringBuilder current = new StringBuilder ( " " ) ; boolean quote = false ; for ( int i = 0 ; i < command . length ( ) ; i ++ ) { if ( quote ) { if ( command . charAt ( i ) == ' " ' ) { quote = false ; lexemes . add ( current . toString ( ) ) ; current = new StringBuilder ( " " ) ; } else { current . append ( command . charAt ( i ) ) ; } } else { if ( command . charAt ( i ) == ' " ' ) { quote = true ; } else if ( command . charAt ( i ) == ' ▁ ' ) { if ( current . length ( ) != 0 ) { lexemes . add ( current . toString ( ) ) ; current = new StringBuilder ( " " ) ; } } else { current . append ( command . charAt ( i ) ) ; } } } for ( String lexeme : lexemes ) { System . out . printf ( " < % s > \n " , lexeme ) ; } } }

s = input ( ) . split ( ' " ' ) NEW_LINE

list1 = list ( ) cmd = input ( ) i = 0 n = len ( cmd ) while ( i < len ( cmd ) and i != - 1 ) : x = cmd [ i ] if x == ' " ' : ind = cmd . find ( ' " ' , i + 1 , n ) if ind == - 1 : break if ind + 1 < len ( cmd ) and cmd [ ind + 1 ] == ' ▁ ' : list1 . append ( cmd [ i + 1 : ind ] ) ; else : ind = cmd . find ( ' " ' , ind + 1 , n ) list1 . append ( cmd [ i + 1 : ind ] ) i = ind + 1 if ind == - 1 : break elif x != ' ▁ ' : j = i while ( i < n and cmd [ i ] != ' ▁ ' ) : i += 1 x = cmd [ j : i ] list1 . append ( x ) i += 1 else : i += 1   for x in list1 : print ( " < " , x , " > " , sep = " " ) NEW_LINE

c , s = list ( ) , input ( ) . split ( ' " ' ) for i in range ( len ( s ) ) : if i & 1 : c . append ( s [ i ] ) else : c . extend ( s [ i ] . split ( ) ) print ( * [ ' < ' + e + ' > ' for e in c ] , sep = ' \n ' ) NEW_LINE

a = str ( input ( ) ) b = ' < ' inKav = Falsex = ' ▁ ' for i in range ( len ( a ) ) : if a [ i ] != ' ▁ ' : if a [ i ] == ' " ' : if inKav : inKav = False else : inKav = True else : b += a [ i ] elif inKav : b += a [ i ] if ( a [ i ] == ' ▁ ' and x != ' ▁ ' and not inKav ) or i + 1 == len ( a ) and a [ i ] != ' ▁ ' : print ( b + ' > ' ) b = ' < ' x = a [ i ] NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   int month , day ; int daysOfMonth = 0 ; int weekLimit = 7 ; int rowCount = 0 ; Scanner sc = new Scanner ( System . in ) ;   month = sc . nextByte ( ) ; day = sc . nextInt ( ) ;   if ( month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12 ) { daysOfMonth = 31 ; } else if ( month == 4 || month == 6 || month == 9 || month == 11 ) { daysOfMonth = 30 ; } else if ( month == 2 ) { daysOfMonth = 28 ; }   daysOfMonth = daysOfMonth - ( ( weekLimit - day ) + 1 ) ;

import java . io . * ; import java . util . * ;   import static java . lang . Math . * ;   import java . time . YearMonth ;   public class Task { public static void main ( String [ ] args ) throws IOException { Reader reader = new Reader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int m = reader . nextInt ( ) ; int d = reader . nextInt ( ) ;   m = YearMonth . of ( 2017 , m ) . lengthOfMonth ( ) ; m -= 8 - d ; int c = 1 ; while ( m > 0 ) { m -= 7 ; ++ c ; }   out . println ( c ) ;   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 . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; public class _p000760A { static public void main ( final String [ ] args ) throws IOException { p000760A . _main ( args ) ; }

import java . util . Scanner ; import java . util . Stack ;   public class ArrayCollection {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int m = scan . nextInt ( ) ; int d = scan . nextInt ( ) ; int days = m == 2 ? 28 : 30 ; if ( m <= 7 && m % 2 != 0 || m > 7 && m % 2 == 0 ) { days = 31 ; } days = days + ( d - 1 ) ; int columns = ( days / 7.0 ) % 1 == 0 ? days / 7 : days / 7 + 1 ; System . out . println ( columns ) ;   }   }

import java . util . Scanner ;   public class PAC { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int m = sc . nextInt ( ) ; int d = sc . nextInt ( ) ; int td ; if ( m == 2 ) td = 28 ; else if ( m == 4 || m == 6 || m == 9 || m == 11 ) td = 30 ; else td = 31 ; td += d - 1 ; System . out . println ( ( td + 6 ) / 7 ) ; sc . close ( ) ; } }

month , day , = map ( int , input ( ) . split ( ) )   short = [ 2 ] mid = [ 4 , 6 , 9 , 11 ] long = [ 1 , 3 , 5 , 7 , 8 , 10 , 12 ]     if month in short : if day == 1 : print ( 4 ) else : print ( 5 )   elif month in mid : if day == 7 : print ( 6 ) else : print ( 5 ) else : if day in ( 6 , 7 ) : print ( 6 ) else : print ( 5 ) NEW_LINE

m , d = map ( int , input ( ) . split ( ) ) from calendar import monthrange x = monthrange ( 2017 , m ) [ 1 ] if x == 28 : if d == 1 : print ( 4 ) else : print ( 5 ) elif x == 31 : if d == 7 or d == 6 : print ( 6 ) else : print ( 5 ) else : if d == 7 : print ( 6 ) else : print ( 5 ) NEW_LINE

import mathm , d = map ( int , input ( ) . split ( ) ) if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12 : t = 31 - ( 8 - d ) y = math . ceil ( t / 7 ) print ( y + 1 ) elif m == 4 or m == 6 or m == 9 or m == 11 : t = 30 - ( 8 - d ) y = math . ceil ( t / 7 ) print ( y + 1 ) else : t = 28 - ( 8 - d ) y = math . ceil ( t / 7 ) print ( y + 1 ) NEW_LINE


import java . io . BufferedReader ; 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 a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ;   } int ans = 1 ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; int nextMinIndex = 0 ; int nextMaxIndex = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) {   if ( a [ i ] <= min ) { nextMinIndex = i ; min = a [ i ] ; } if ( a [ i ] >= max ) { nextMaxIndex = i ; max = Math . max ( max , a [ i ] ) ; } if ( Math . abs ( max - min ) <= 1 ) { count ++ ; ans = Math . max ( ans , count ) ; } else { count = 0 ; min = Integer . MAX_VALUE ; max = Integer . MIN_VALUE ; i = Math . min ( nextMaxIndex , nextMinIndex ) ; } } System . out . println ( ans ) ;   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

import java . util . Scanner ;   public class ConstantRange { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n = scanner . nextInt ( ) ; Integer [ ] range = new Integer [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) range [ i ] = scanner . nextInt ( ) ;   int len = 1 ; int maxLen = 1 ; int max = 0 ; int min = 0 ; int latestMin = 0 ; int latestMax = 0 ;   for ( int i = 1 ; i < n ; i ++ ) { int change = i ; int newmin = min ; int newmax = max ; if ( range [ max ] < range [ i ] ) { latestMax = i ; if ( max == min ) { newmax = i ; } else { newmax = i ; change = latestMin ; newmin = change + 1 ; latestMin ++ ; len = - 1 ; } } else if ( range [ max ] . equals ( range [ i ] ) ) { latestMax = i ; }   if ( range [ min ] > range [ i ] ) { latestMin = i ; if ( max == min ) { newmin = i ; } else { newmin = i ;   change = latestMax ; newmax = change + 1 ; latestMax ++ ; len = - 1 ; } } else if ( range [ min ] . equals ( range [ i ] ) ) { latestMin = i ; }   i = change ; len ++ ;   min = newmin ; max = newmax ;   if ( maxLen < len ) maxLen = len ; }   System . out . println ( maxLen ) ; } }

import java . util . Scanner ;   public class ApproximatingaConstantRange {   static Scanner sc ;   public static void main ( String [ ] args ) {   sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;

import java . io . BufferedWriter ; import java . io . ByteArrayInputStream ; import java . io . FileInputStream ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main { private static final long MOD = ( long ) 1e9 + 7 ; static InputStream is ; static PrintWriter out ; static String INPUT = " " ; static int lenbuf = 0 , ptrbuf = 0 ; private static byte [ ] inbuf = new byte [ 1024 ] ; static boolean readFile = false ;

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

from collections import * from sys import stdin , stdoutinput = stdin . readlinen , a , l , p = int ( input ( ) ) , list ( map ( int , input ( ) . split ( ) ) ) , defaultdict ( int ) , 1 for i in range ( n ) : p = max ( p , i + 1 - ( max ( l [ a [ i ] + 1 ] , l [ a [ i ] - 2 ] ) if l [ a [ i ] - 1 ] > l [ a [ i ] + 1 ] else max ( l [ a [ i ] + 2 ] , l [ a [ i ] - 1 ] ) ) ) ; l [ a [ i ] ] = i + 1 ; print ( p ) NEW_LINE

n = int ( input ( ) ) p = [ 0 ] * 100003 ans = - 1 ar = input ( ) . split ( ) for i in range ( 1 , n + 1 ) : x = int ( ar [ i - 1 ] ) if ( p [ x - 1 ] > p [ x + 1 ] ) : ans = max ( ans , i - max ( p [ x + 1 ] , p [ x - 2 ] ) ) else : ans = max ( ans , i - max ( p [ x + 2 ] , p [ x - 1 ] ) ) p [ x ] = i ; print ( ans ) NEW_LINE


import java . io . * ; import java . util . * ;   import static java . lang . Math . max ;    public class Main { BufferedReader br ; StringTokenizer in ; PrintWriter pw ; Random r ; int INF = ( int ) ( 2 * 1e9 ) + 1 ; long LNF = ( long ) 1e18 ; long mod = ( long ) ( 1e9 + 7 ) ; int pp = 27 ;

n , m , d = map ( int , input ( ) . split ( ) ) ph = [ [ int ( j ) for j in input ( ) . split ( ) ] for i in range ( n ) ] inf = [ [ int ( j ) for j in input ( ) . split ( ) ] for i in range ( m ) ] for i in range ( n ) : ph [ i ] [ 1 ] = - ph [ i ] [ 1 ] for i in range ( m ) : inf [ i ] [ 1 ] = - inf [ i ] [ 1 ] ph . sort ( reverse = True ) inf . sort ( reverse = True ) sw , sc = 0 , 0 for p in inf : sc += p [ 0 ] d += p [ 1 ] ans = 0 z = m - 1 for p in ph : sc += p [ 0 ] d += p [ 1 ] NEW_LINE

n , m , d = list ( map ( int , input ( ) . split ( ) ) )   a = [ ] b = [ ]   for i in range ( n ) : a . append ( list ( map ( int , input ( ) . split ( ) ) ) )   for i in range ( m ) : b . append ( list ( map ( int , input ( ) . split ( ) ) ) )   a = sorted ( a , key = lambda x : x [ 0 ] + ( 1 - x [ 1 ] * 1e-10 ) ) b = sorted ( b , key = lambda x : x [ 0 ] + ( 1 - x [ 1 ] * 1e-10 ) )   tc , td = 0 , 0   tc += a [ - 1 ] [ 0 ] tc += b [ - 1 ] [ 0 ] td += a [ - 1 ] [ 1 ] td += b [ - 1 ] [ 1 ]   ai = n - 1 bi = m - 1   if td > d : print ( 0 ) exit ( )   while ai > 0 : t = ai - 1 if td + a [ t ] [ 1 ] <= d : td += a [ t ] [ 1 ] tc += a [ t ] [ 0 ] ai -= 1 continue else : break cmax = tc   while bi > 0 : bi -= 1 tc += b [ bi ] [ 0 ] td += b [ bi ] [ 1 ] while td > d and ai < n : tc -= a [ ai ] [ 0 ] td -= a [ ai ] [ 1 ] ai += 1 if ai == n : break if td <= d : cmax = max ( cmax , tc ) print ( cmax ) NEW_LINE


import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . Scanner ; import java . util . TreeMap ; import java . util . TreeSet ;    public class Main {   public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s [ ] = new String [ n ] ; int max = 0 ; for ( int i = 0 ; i < n ; i ++ ) { s [ i ] = input . next ( ) ; } int len = 0 ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { for ( char j = ' a ' ; j <= ' z ' ; j ++ ) { len = 0 ; for ( int k = 0 ; k < n ; k ++ ) { String test = s [ k ] ; String x = String . valueOf ( i ) ; String y = String . valueOf ( j ) ; test = test . replaceAll ( x , " " ) ; test = test . replaceAll ( y , " " ) ; if ( test . length ( ) == 0 ) { len += s [ k ] . length ( ) ; } } max = Math . max ( len , max ) ; } } System . out . println ( max ) ; } }

import java . util . * ;    public class BruteForce {   public static Scanner in = new Scanner ( System . in ) ; public static boolean check ( String txt ) { HashSet < Integer > set = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < txt . length ( ) ; i ++ ) set . add ( ( int ) txt . charAt ( i ) ) ; if ( set . size ( ) > 2 ) return false ; else return true ; } public static long getCost ( ArrayList < String > list , char a , char b ) { long cost = 0 ; if ( a == b ) { for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int count = 0 ; String cur = list . get ( i ) ; for ( int j = 0 ; j < cur . length ( ) ; j ++ ) { if ( cur . charAt ( j ) == a ) count ++ ; else { count = 0 ; break ; } } cost += count ; } } else { for ( int i = 0 ; i < list . size ( ) ; i ++ ) { int count = 0 ; String cur = list . get ( i ) ; for ( int j = 0 ; j < cur . length ( ) ; j ++ ) { if ( cur . charAt ( j ) == a || cur . charAt ( j ) == b ) count ++ ; else { count = 0 ; break ; } } cost += count ; } } return cost ; } public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; ArrayList < String > list = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String cur = in . next ( ) ; if ( check ( cur ) ) list . add ( cur ) ; } long max = 0 ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { for ( char j = ' a ' ; j <= ' z ' ; j ++ ) { long cur = getCost ( list , i , j ) ; max = Math . max ( cur , max ) ; } } System . out . println ( max ) ; } }

import java . util . * ; import static java . lang . Math . * ; import java . io . * ;   public class SolutionB { public static void main ( String args [ ] ) throws IOException { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > words = new ArrayList < String > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . next ( ) ; Set < Character > set = new HashSet < Character > ( ) ; boolean valid = true ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { set . add ( s . charAt ( j ) ) ; if ( set . size ( ) > 2 ) { valid = false ; break ; } } if ( valid ) words . add ( s ) ; } int max = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { for ( int j = i + 1 ; j < 26 ; j ++ ) { char c1 = ( char ) ( i + ' a ' ) ; char c2 = ( char ) ( j + ' a ' ) ; int curr = 0 ; for ( String s : words ) { boolean valid = true ; for ( int k = 0 ; k < s . length ( ) ; k ++ ) { char c = s . charAt ( k ) ; if ( c != c1 && c != c2 ) { valid = false ; break ; } } if ( valid ) curr += s . length ( ) ; } max = Math . max ( curr , max ) ; } } System . out . println ( max ) ; } }

import java . util . Scanner ; import java . util . Arrays ; import java . util . Vector ;    public class MainTest {

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

n = int ( input ( ) ) N = [ ] d = { } c = 0 M = { } for i in range ( n ) : s = input ( ) p = set ( s ) if len ( p ) > 2 : continue else : N . append ( len ( s ) ) d . update ( { c : p } ) c += 1 if len ( p ) == 1 : if s [ 0 ] not in M . keys ( ) : M . update ( { s [ 0 ] : len ( s ) } ) else : M [ s [ 0 ] ] += len ( s ) best = 0 done = [ ] for i in d : if d [ i ] not in done : p = d [ i ] c_sum = 0 for j in d : if d [ j ] . issubset ( p ) == True : c_sum += N [ j ] done . append ( d [ i ] ) best = max ( c_sum , best ) best_single = 0 for i in M : for j in M : if i != j : best_single = max ( best_single , M [ i ] + M [ j ] ) print ( max ( best , best_single ) )     NEW_LINE

n = int ( input ( ) ) l = [ ] ans = 0 for i in range ( n ) : s = input ( ) l . append ( s ) x = " abcdefghijklmnopqrstuvwxyz " for i in range ( 26 ) : for j in range ( 26 ) : if ( i == j ) : continue c = 0 for s in l : l1 = len ( s ) if ( s . count ( x [ i ] ) + s . count ( x [ j ] ) == l1 ) : c += l1 ans = max ( ans , c ) for i in range ( 26 ) : c = 0 for s in l : l1 = len ( s ) if ( s . count ( x [ i ] ) == l1 ) : c += l1 ans = max ( ans , c ) print ( ans )   NEW_LINE

n = int ( input ( ) ) l = [ ] ans = 0 for i in range ( n ) : s = input ( ) l . append ( s ) x = " abcdefghijklmnopqrstuvwxyz " for i in range ( 26 ) : for j in range ( i + 1 , 26 ) : c = 0 for s in l : l1 = len ( s ) if ( s . count ( x [ i ] ) + s . count ( x [ j ] ) == l1 ) : c += l1 ans = max ( ans , c )   c = 0 for s in l : l1 = len ( s ) if ( s . count ( ' z ' ) == l1 ) : c += l1ans = max ( ans , c ) print ( ans )   NEW_LINE

n = int ( input ( ) ) l = [ ] ans = 0 for i in range ( n ) : s = input ( ) l . append ( s ) x = " abcdefghijklmnopqrstuvwxyz " for i in range ( 26 ) : for j in range ( i + 1 , 26 ) : c = 0 for s in l : l1 = len ( s ) if ( s . count ( x [ i ] ) + s . count ( x [ j ] ) == l1 ) : c += l1 ans = max ( ans , c )   print ( ans )   NEW_LINE

n = int ( input ( ) )   words = [ ] letters = [ ] letfreq = { }   res = [ ]   for w in range ( n ) : wo = input ( ) if len ( set ( list ( wo ) ) ) < 3 : words . append ( wo ) for let in set ( list ( wo ) ) : letters . append ( let )   if len ( words ) == 0 : print ( 0 ) exit ( )   if len ( set ( letters ) ) == 1 : cnt = 0 for bruhy in words : cnt += len ( bruhy ) print ( cnt ) exit ( )   for lt1 in set ( letters ) : for lt2 in set ( letters ) : loc = 0 for o in words : if o . count ( lt1 ) + o . count ( lt2 ) == len ( o ) : loc += len ( o ) res . append ( loc )   print ( max ( res ) )   NEW_LINE


import java . io . * ; import java . util . * ; public class Main { public static void main ( String [ ] args ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = 1 ; while ( T -- > 0 ) { int l = input . nextInt ( ) ; Stack < Long > st = new Stack < > ( ) ; long ans = 0 ; long inf = ( long ) Math . pow ( 2 , 32 ) ; st . push ( 1L ) ; for ( int i = 0 ; i < l ; i ++ ) { String s = input . next ( ) ; if ( s . equals ( " for " ) ) { int n = input . nextInt ( ) ; long x = st . peek ( ) ; x = x * n ; st . push ( Math . min ( inf , x ) ) ; } else if ( s . equals ( " add " ) ) { ans += st . peek ( ) ; } else { st . pop ( ) ; } } if ( ans >= inf ) { out . println ( " OVERFLOW ! ! ! " ) ; } else { out . println ( ans ) ; } } out . close ( ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }

import java . util . * ; import java . io . * ; public class Mamo { static long mod = 1000000007 ; static Reader in = new Reader ( ) ; static List < Integer > G [ ] ; static long a [ ] , p [ ] , xp [ ] , xv [ ] ; static StringBuilder Sd = new StringBuilder ( ) , Sl = new StringBuilder ( ) ; public static void main ( String [ ] args ) {

import java . util . * ; public class B_Edu66 { public static void main ( String [ ] args ) { Scanner omkar = new Scanner ( System . in ) ; int lines = omkar . nextInt ( ) ; long x = 0 ; long mult = 1 ; int temp ; int notMult = 0 ; Stack < Integer > stack = new Stack < Integer > ( ) ; String st ; for ( int i = 0 ; i < lines ; i ++ ) { st = omkar . next ( ) ; if ( st . charAt ( 0 ) == ' f ' ) { temp = omkar . nextInt ( ) ; stack . push ( temp ) ; if ( mult < Math . pow ( 2 , 32 ) ) { mult = mult * temp ; } else { notMult ++ ; } } if ( st . charAt ( 0 ) == ' a ' ) { x += mult ; if ( x >= Math . pow ( 2 , 32 ) ) { System . out . println ( " OVERFLOW ! ! ! " ) ; return ; } } if ( st . charAt ( 0 ) == ' e ' ) { if ( notMult > 0 ) { notMult -- ; stack . pop ( ) ; } else { mult = mult / stack . pop ( ) ; } } } System . out . println ( x ) ; }   }

import java . util . * ; import java . io . * ; public class EdA { static long [ ] mods = { 1000000007 , 998244353 , 1000000009 } ; static long mod = mods [ 0 ] ; public static MyScanner sc ; public static PrintWriter out ; public static void main ( String [ ] omkar ) throws Exception {

from collections import defaultdict , OrderedDict , Counterfrom sys import stdin , stdoutfrom bisect import bisect_left , bisect_right NEW_LINE

import timestartTimeProblem = time . time ( )   import fileinput , sys , itertools , functools , mathfrom bisect import * from heapq import * from collections import *     MOD = 10 ** 9 + 7 NEW_LINE

a = int ( input ( ) ) ans = [ ] prod = 1 total = 0 qem = pow ( 2 , 32 ) flag = 0 count = 0 kam = [ ] for i in range ( a ) : s = input ( ) if ( s [ 0 ] == ' a ' ) : gam = 1 if ( len ( ans ) - count >= 32 ) : print ( ' OVERFLOW ! ! ! ' ) exit ( 0 ) ; else : for j in kam : gam = gam * j total += gam if ( total >= qem ) : print ( ' OVERFLOW ! ! ! ' ) exit ( 0 ) ; elif ( s [ 0 ] == ' e ' ) : t = ans . pop ( ) if ( t == 1 ) : count -= 1 else : kam . pop ( ) else : r = int ( s [ 4 : : ] ) ans . append ( r ) if ( r == 1 ) : count += 1 if ( r - 1 ) : kam . append ( r ) print ( total ) NEW_LINE


import java . util . * ;   public class CodeForces982A { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; String s = input . next ( ) ; int d = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '1' ) { if ( d == - 1 ) { if ( i >= 2 ) { System . out . println ( " NO " ) ; return ; } } else if ( i - d == 1 || i - d > 3 ) { System . out . println ( " NO " ) ; return ; } d = i ; } }   if ( n - d > 2 || d == - 1 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } } }

import java . util . * ; import java . io . * ;   public class Div688A {

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class Row { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; Task solver = new Task ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class Task { public void solve ( int testNumber , InputReader in , PrintWriter out ) { int n = in . nextInt ( ) ; String s = "0" + in . next ( ) + "0" ; if ( s . indexOf ( "000" ) != - 1 || s . indexOf ( "11" ) != - 1 ) { out . println ( " No " ) ; } else { out . println ( " Yes " ) ; } } }   static class InputReader { public BufferedReader reader ; public StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   public String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

import java . io . * ; import java . util . * ; import javax . print . attribute . standard . Finishings ;   import java . math . * ;   public class SnackTower { static final Random random = new Random ( ) ; static PrintWriter out = new PrintWriter ( ( System . out ) ) ; static Reader sc = new Reader ( ) ;   public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;   int c1 = 0 ; int c0 = 0 ; String s = sc . next ( ) ; boolean f = false ; if ( s . contains ( "11" ) || s . contains ( "000" ) ) { System . out . println ( " NO " ) ; f = true ; }   else { for ( int i = 0 ; i < s . length ( ) ; i ++ )   if ( s . charAt ( i ) == '1' ) c1 ++ ; if ( c1 < ( int ) Math . ceil ( ( double ) n / 3.00 ) ) { System . out . println ( " No " ) ; } else { if ( ( s . charAt ( n - 1 ) == '0' && s . charAt ( n - 2 ) == '0' ) || ( s . charAt ( 0 ) == '0' && s . charAt ( 1 ) == '0' ) ) System . out . println ( " No " ) ; else System . out . println ( " Yes " ) ; }   }

n = int ( input ( ) ) s = str ( input ( ) ) s = '0' + s + '0' if ( '11' in s ) or ( '000' in s ) : print ( " No " ) else : print ( " Yes " ) NEW_LINE

n = int ( input ( ) ) s = input ( ) if ( n == 1 ) : if ( s == "0" ) : print ( " No " ) else : print ( " Yes " ) exit ( 0 ) if ( "11" in s ) or ( "000" in s ) or ( s [ - 2 : ] == "00" ) or ( s [ : 2 ] == "00" ) : print ( " No " ) else : print ( " Yes " ) NEW_LINE

n = int ( input ( ) ) s = str ( input ( ) ) ans = ' YES ' count = 1 for i in range ( n ) : if int ( s [ i ] ) == 0 : count += 1 elif int ( s [ i ] ) == 1 and count > 0 : count = 0 else : ans = " NO " break if count > 2 : ans = " NO " breakif len ( s ) == 1 and int ( s [ 0 ] ) == 0 : ans = ' NO ' if count >= 2 : ans = ' NO ' print ( ans ) NEW_LINE

n = int ( input ( ) ) s = input ( ) a = '0' + s + '0' if '000' in a or '11' in a : print ( " NO " ) else : print ( " YES " ) NEW_LINE


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

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

import java . util . * ; import java . math . * ; import java . io . * ; import java . lang . * ; public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } int [ ] nextIntArray ( int n ) { int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = Integer . parseInt ( next ( ) ) ; } return a ; } } private static long startTime = System . currentTimeMillis ( ) ; public static void main ( String [ ] args ) { FastReader sc = new FastReader ( ) ; int n = sc . nextInt ( ) ; int a [ ] = sc . nextIntArray ( n ) ; HashSet < Integer > hs = new HashSet < > ( ) ; for ( int i : a ) { hs . add ( 0 - i ) ; } System . out . println ( hs . contains ( 0 ) ? hs . size ( ) - 1 : hs . size ( ) ) ; } }

import java . util . HashSet ; import java . util . Scanner ;   public class NastyaandanArray {   public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int c = 0 ; HashSet < Integer > a = new HashSet < Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int in = scan . nextInt ( ) ; a . add ( in ) ; if ( in == 0 ) { ++ c ; } } int res = a . size ( ) ; if ( c != 0 ) { -- res ; } System . out . println ( res ) ; }   }

input ( ) print ( len ( set ( input ( ) . split ( ) ) - { '0' } ) ) NEW_LINE

n = int ( input ( ) ) a = [ * map ( int , input ( ) . split ( ) ) ] d = { } for i in a : if i != 0 : if d . get ( i ) == None : d [ i ] = 1 else : d [ i ] += 1 print ( len ( d ) ) NEW_LINE

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 if ( l . count ( 0 ) >= 1 ) : print ( len ( d ) - 1 ) else : print ( len ( d ) ) NEW_LINE

n = input ( ) l = list ( map ( int , input ( ) . split ( ) ) ) d = { } for i in l : if ( i != 0 ) : if ( i in d ) : d [ i ] += 1 else : d [ i ] = 1 print ( len ( d ) ) NEW_LINE

i = int ( input ( ) ) s = list ( input ( ) . split ( ) ) l = { } c = 0 for j in range ( i ) : if int ( s [ j ] ) != 0 : if int ( s [ j ] ) not in l . keys ( ) : l [ int ( s [ j ] ) ] = 1 c += 1 else : l [ int ( s [ j ] ) ] += 1 print ( c ) NEW_LINE


import java . util . * ; import java . lang . * ; import java . io . * ; public class LinkedList { public static void main ( String [ ] args ) throws java . lang . Exception { Scanner sc = new Scanner ( System . in ) ;

import java . util . Arrays ; import java . util . Scanner ;   public class comp2 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int k = in . nextInt ( ) ; int num = 2 ; int ans [ ] [ ] = new int [ 100 ] [ 100 ] ; int i = 0 ;   while ( k > 0 ) { if ( k < i ) { i = 0 ;   num ++ ; } ans [ num - 1 ] [ i ] = 1 ; ans [ i ] [ num - 1 ] = 1 ; k -= i ; i ++ ; if ( i >= num - 1 && k > 0 ) { i = 0 ; num ++ ; }   } System . out . println ( num ) ; for ( int j = 0 ; j < num ; j ++ ) { for ( int m = 0 ; m < num ; m ++ ) { System . out . print ( ans [ j ] [ m ] ) ; } System . out . println ( " " ) ;   } } }

n , k = 0 , int ( input ( ) ) p = [ [ '0' ] * 100 for i in range ( 100 ) ] while k : for i in range ( n ) : if i > k : break p [ n ] [ i ] = p [ i ] [ n ] = '1' k = k - i n += 1 print ( n ) for i in range ( n ) : print ( ' ' . join ( p [ i ] [ : n ] ) ) NEW_LINE

k = int ( input ( ) ) p = [ [ '0' ] * 100 for j in range ( 100 ) ] i , n = 0 , 0   g = lambda n : n * ( n * n - 1 ) // 6 while g ( n + 1 ) <= k : n += 1 while i < n + 1 : for j in range ( i ) : p [ i ] [ j ] = p [ j ] [ i ] = '1' i += 1 k -= g ( n )   g = lambda n : n * ( n - 1 ) // 2 while k : n = 0 while g ( n + 1 ) <= k : n += 1 for j in range ( n ) : p [ i ] [ j ] = p [ j ] [ i ] = '1' k -= g ( n ) i += 1 print ( i ) for j in range ( i ) : print ( ' ' . join ( p [ j ] [ : i ] ) ) NEW_LINE


import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintStream ; import java . io . BufferedOutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . InputMismatchException ;   public class Main {   public static void main ( String [ ] args ) { if ( args . length > 0 && args [ 0 ] . toLowerCase ( ) . equals ( " local " ) ) { try { System . setIn ( new FileInputStream ( " input . txt " ) ) ; System . setOut ( new PrintStream ( new File ( " output . txt " ) ) ) ; } catch ( IOException exc ) { } } Task task = new Task ( ) ; task . solve ( ) ; }   public static class Task { static final long MOD = ( long ) 1e9 + 7 ; static final PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; int [ ] [ ] grid ; int res = 0 ;   public void solve ( ) { try { Scan sc = new Scan ( ) ; grid = new int [ 5 ] [ 5 ] ; for ( int i = 0 ; i < 5 ; ++ i ) { for ( int j = 0 ; j < 5 ; ++ j ) { grid [ i ] [ j ] = ( int ) sc . scanLong ( ) ; } } perm ( new int [ ] { 0 , 1 , 2 , 3 , 4 } , 5 ) ; out . println ( res ) ; } finally { out . close ( ) ; } }   private void perm ( int [ ] arr , int end ) { if ( end == 1 ) {

import java . util . * ; public class Main { static int a [ ] [ ] = new int [ 5 ] [ 5 ] ; static int max = 0 ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { a [ i ] [ j ] = input . nextInt ( ) ; } } HashSet < String > set = new HashSet < > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { if ( j == i ) continue ; for ( int k = 0 ; k < 5 ; k ++ ) { if ( k == j || k == i ) continue ; for ( int l = 0 ; l < 5 ; l ++ ) { if ( l == i || l == j || l == k ) continue ; for ( int m = 0 ; m < 5 ; m ++ ) { if ( m == l || m == k || m == j || m == i ) continue ; String s = i + " " + j + " " + k + " " + l + " " + m ; set . add ( s ) ; } } } } }

import java . util . * ; public class Main { static int a [ ] [ ] = new int [ 5 ] [ 5 ] ; static int max = 0 ; public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { a [ i ] [ j ] = input . nextInt ( ) ; } } int num [ ] = new int [ ] { 0 , 1 , 2 , 3 , 4 } ; permutation ( 0 , num ) ; System . out . println ( max ) ; }   static void permutation ( int s , int [ ] num ) { if ( s == num . length ) { int sum = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = i ; j < 4 ; j += 2 ) { sum += a [ num [ j ] ] [ num [ j + 1 ] ] + a [ num [ j + 1 ] ] [ num [ j ] ] ; } } max = Math . max ( max , sum ) ; return ; } for ( int i = s ; i < num . length ; i ++ ) { swap ( num , s , i ) ; permutation ( s + 1 , num ) ; swap ( num , s , i ) ; } }   static void swap ( int [ ] num , int s , int i ) { int tmp = num [ s ] ; num [ s ] = num [ i ] ; num [ i ] = tmp ; } }

import java . util . * ; import java . io . * ; public class A { static FastReader in = new FastReader ( ) ; static final Random random = new Random ( ) ; static long mod = 1000000007L ;   public static void main ( String args [ ] ) throws IOException { int t = 1 ;

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . * ;   public class experiment { static int M = 1_000_000_007 ; static int INF = Integer . MAX_VALUE ; static final FastScanner fs = new FastScanner ( ) ;

lista = [ ] for i in range ( 5 ) : lista . append ( input ( ) . split ( ) )   sums = [ ] for i in range ( 0 , 5 ) : for j in range ( 0 , 5 ) : for k in range ( 0 , 5 ) : for l in range ( 0 , 5 ) : for m in range ( 0 , 5 ) : a = int ( lista [ i ] [ j ] ) + int ( lista [ j ] [ i ] ) b = int ( lista [ k ] [ l ] ) + int ( lista [ l ] [ k ] ) c = int ( lista [ j ] [ k ] ) + int ( lista [ k ] [ j ] ) d = int ( lista [ l ] [ m ] ) + int ( lista [ m ] [ l ] ) s = a + 2 * b + c + 2 * d lx = [ i , j , k , l , m ] if not any ( lx . count ( x ) > 1 for x in lx ) : sums . append ( s ) print ( max ( sums ) )   NEW_LINE

import itertoolshappy = [ ] mhappy = 0 p = [ list ( i ) for i in itertools . permutations ( [ 0 , 1 , 2 , 3 , 4 ] ) ] for i in range ( 5 ) : happy . append ( [ int ( a ) for a in input ( ) . split ( ) ] ) for i in range ( len ( p ) ) : aux = ( happy [ p [ i ] [ 0 ] ] [ p [ i ] [ 1 ] ] + happy [ p [ i ] [ 1 ] ] [ p [ i ] [ 0 ] ] + 2 * happy [ p [ i ] [ 2 ] ] [ p [ i ] [ 3 ] ] + 2 * happy [ p [ i ] [ 3 ] ] [ p [ i ] [ 2 ] ] ) + ( happy [ p [ i ] [ 1 ] ] [ p [ i ] [ 2 ] ] + happy [ p [ i ] [ 2 ] ] [ p [ i ] [ 1 ] ] + 2 * happy [ p [ i ] [ 3 ] ] [ p [ i ] [ 4 ] ] + 2 * happy [ p [ i ] [ 4 ] ] [ p [ i ] [ 3 ] ] ) mhappy = max ( mhappy , aux ) print ( mhappy )   NEW_LINE

possibilidades = [ ] for i in range ( 5 ) : lista = [ ] for j in range ( 5 ) : if j == i : continue for k in range ( 5 ) : if k == j or k == i : continue for l in range ( 5 ) : if l == k or l == j or l == i : continue for m in range ( 5 ) : if m == l or m == k or m == j or m == i : continue lista . append ( i ) lista . append ( j ) lista . append ( k ) lista . append ( l ) lista . append ( m ) possibilidades . append ( lista ) lista = [ ]   matriz = [ ] linha = [ ] max = 0 num = 0 for i in range ( 5 ) : linha = input ( ) . split ( ) matriz . append ( linha ) for i in range ( len ( possibilidades ) ) : num = 0 num += int ( matriz [ possibilidades [ i ] [ 0 ] ] [ possibilidades [ i ] [ 1 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 1 ] ] [ possibilidades [ i ] [ 0 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 1 ] ] [ possibilidades [ i ] [ 2 ] ] ) num += int ( matriz [ possibilidades [ i ] [ 2 ] ] [ possibilidades [ i ] [ 1 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 2 ] ] [ possibilidades [ i ] [ 3 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 3 ] ] [ possibilidades [ i ] [ 2 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 3 ] ] [ possibilidades [ i ] [ 4 ] ] ) num += 2 * int ( matriz [ possibilidades [ i ] [ 4 ] ] [ possibilidades [ i ] [ 3 ] ] ) if num > max : max = numprint ( max ) NEW_LINE

import itertoolspermutations = [ ]   for x in itertools . permutations ( [ 0 , 1 , 2 , 3 , 4 ] ) : permutations . append ( x )   matrix = [ ] for i in range ( 5 ) : matrix . append ( [ int ( val ) for val in input ( ) . split ( ) ] )   bigger = 0 for p in permutations : a = p [ 0 ] b = p [ 1 ] c = p [ 2 ] d = p [ 3 ] e = p [ 4 ] flag = ( matrix [ a ] [ b ] + matrix [ b ] [ a ] ) + ( matrix [ c ] [ d ] + matrix [ d ] [ c ] ) + ( matrix [ b ] [ c ] + matrix [ c ] [ b ] ) + ( matrix [ d ] [ e ] + matrix [ e ] [ d ] ) + ( matrix [ c ] [ d ] + matrix [ d ] [ c ] ) + ( matrix [ d ] [ e ] + matrix [ e ] [ d ] ) if ( flag > bigger ) : bigger = flagprint ( bigger ) NEW_LINE

from itertools import permutations     def main ( ) :   m = [ ] for i in range ( 5 ) : row = [ int ( j ) for j in input ( ) . split ( ) ] m . append ( row )   p = permutations ( range ( 5 ) )   max = 0 for j in list ( p ) :     acum = 0 acum += m [ j [ 0 ] ] [ j [ 1 ] ] + m [ j [ 2 ] ] [ j [ 3 ] ] + m [ j [ 1 ] ] [ j [ 0 ] ] + m [ j [ 3 ] ] [ j [ 2 ] ] acum += m [ j [ 1 ] ] [ j [ 2 ] ] + m [ j [ 3 ] ] [ j [ 4 ] ] + m [ j [ 2 ] ] [ j [ 1 ] ] + m [ j [ 4 ] ] [ j [ 3 ] ] acum += m [ j [ 2 ] ] [ j [ 3 ] ] + m [ j [ 3 ] ] [ j [ 2 ] ] acum += m [ j [ 3 ] ] [ j [ 4 ] ] + m [ j [ 4 ] ] [ j [ 3 ] ]   if acum > max : max = acum   print ( max ) return   main ( ) NEW_LINE


import java . util . Scanner ; public class codeforces813A { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int x = 0 , n = s . nextInt ( ) , i , m , ans = 0 ; boolean j = false ; for ( i = 0 ; i < n ; i ++ ) x = x + s . nextInt ( ) ; m = s . nextInt ( ) ; int [ ] c = new int [ m ] ; int [ ] b = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { c [ i ] = s . nextInt ( ) ; b [ i ] = s . nextInt ( ) ; } for ( i = 0 ; i < m ; i ++ ) { if ( x >= c [ i ] && x <= b [ i ] ) { ans = x ; j = true ; break ; } else if ( x < c [ i ] ) { ans = c [ i ] ; j = true ; break ; } } if ( j == true ) System . out . print ( ans ) ; else System . out . print ( - 1 ) ; } }

import java . util . Scanner ;   public class A813 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int N = in . nextInt ( ) ; int total = 0 ; for ( int n = 0 ; n < N ; n ++ ) { total += in . nextInt ( ) ; } int M = in . nextInt ( ) ; int answer = Integer . MAX_VALUE ; for ( int m = 0 ; m < M ; m ++ ) { int L = in . nextInt ( ) ; int R = in . nextInt ( ) ; if ( total <= R ) { answer = Math . min ( answer , Math . max ( L , total ) ) ; } } if ( answer == Integer . MAX_VALUE ) { answer = - 1 ; } System . out . println ( answer ) ; }   }

import java . util . Scanner ;   public class qH {   public static void main ( String args [ ] ) { Scanner s = new Scanner ( System . in ) ;   int n = s . nextInt ( ) ;   long total_time = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { total_time += s . nextInt ( ) ; }   int m = s . nextInt ( ) ;   long slot = - 1 ; for ( int i = 0 ; i < m ; i ++ ) { int l = s . nextInt ( ) ; int r = s . nextInt ( ) ;   if ( slot == - 1 ) { if ( total_time <= l ) { slot = l ; } else if ( total_time >= l && total_time <= r ) { slot = total_time ; } } }   System . out . println ( slot ) ; } }

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class A813 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;

def find ( x , y , n ) : for i in range ( x , y + 1 ) : if i >= n : return i return 0                   n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) m = int ( input ( ) ) f = Truefor i in range ( m ) : x , y = map ( int , input ( ) . split ( ) ) if find ( x , y , sum ( a ) ) != 0 and f : print ( find ( x , y , sum ( a ) ) ) f = Falseif f : print ( - 1 ) NEW_LINE

n = int ( input ( ) ) a = sum ( map ( int , input ( ) . split ( ) ) ) for _ in range ( int ( input ( ) ) ) : q , w = map ( int , input ( ) . split ( ) ) if a <= w : exit ( print ( max ( a , q ) ) ) print ( - 1 ) NEW_LINE

def main ( ) : n = int ( input ( ) ) a = [ int ( s ) for s in input ( ) . split ( ) ] m = int ( input ( ) ) if m == 0 : print ( - 1 ) return l , r = [ ] , [ ] for _ in range ( m ) : x , y = [ int ( s ) for s in input ( ) . split ( ) ] l . append ( x ) r . append ( y )   total_time = sum ( a ) period = 0 while period < m and total_time > r [ period ] : period += 1 if period < m : print ( max ( total_time , l [ period ] ) ) else : print ( - 1 )   main ( ) NEW_LINE

def solve ( ) : n = int ( input ( ) ) a = [ int ( s ) for s in input ( ) . split ( ' ▁ ' ) ] x = sum ( a ) m = int ( input ( ) ) u = [ tuple ( [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] ) for i in range ( m ) ] for l , r in u : if r >= x : return max ( l , x ) return - 1     print ( solve ( ) ) NEW_LINE

a = 0 c = input ( ) for x in list ( map ( int , input ( ) . split ( ) ) ) : a += xb = [ ] for x in range ( int ( input ( ) ) ) : i , j = map ( int , input ( ) . split ( ) ) for y in range ( i , j + 1 ) : b . append ( y ) for x in b : if a == x or a < x : print ( x ) breakelse : print ( - 1 ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { public static void main ( String [ ] args ) throws IOException { FastScanner in = new FastScanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ; new Main ( ) . run ( in , out ) ; out . close ( ) ; }   public static long mod = 17352642619633L ;   int N ; int [ ] a ; void run ( FastScanner in , PrintWriter out ) { N = in . nextInt ( ) * 2 ; a = new int [ N ] ; for ( int i = 0 ; i < a . length ; i ++ ) a [ i ] = in . nextInt ( ) ; Arrays . sort ( a ) ;   int [ ] [ ] dp = new int [ N + 1 ] [ 3 ] ; for ( int [ ] d : dp ) Arrays . fill ( d , Integer . MAX_VALUE ) ; for ( int i = 0 ; i < 3 ; i ++ ) dp [ 0 ] [ i ] = 0 ;

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

import java . io . * ; import java . util . * ;   public class kayaking { public static void main ( String [ ] args ) throws IOException { BufferedReader f = new BufferedReader ( new InputStreamReader ( System . in ) ) ; PrintWriter out = new PrintWriter ( System . out ) ; StringTokenizer st = new StringTokenizer ( f . readLine ( ) ) ; int numKayaks = Integer . parseInt ( st . nextToken ( ) ) * 2 ; int [ ] diff = new int [ numKayaks ] ; st = new StringTokenizer ( f . readLine ( ) ) ; for ( int i = 0 ; i < numKayaks ; i ++ ) { diff [ i ] = Integer . parseInt ( st . nextToken ( ) ) ; } Arrays . sort ( diff ) ; int min = Integer . MAX_VALUE ; for ( int i = 0 ; i < numKayaks ; i ++ ) { for ( int j = i + 1 ; j < numKayaks ; j ++ ) { int sum = 0 ; int index = - 1 ; for ( int k = 0 ; k < numKayaks ; k ++ ) { if ( k == i || k == j ) { continue ; } else if ( index == - 1 ) { index = k ; } else { sum += diff [ k ] - diff [ index ] ; index = - 1 ; } } min = Math . min ( min , sum ) ; } } out . println ( min ) ; out . close ( ) ; } }

n = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) nat = Falsefor i in range ( 2 * n ) : for c in range ( i + 1 , 2 * n ) : ls = l [ : ] ls [ i ] = 0 ls [ c ] = 0 ls = sorted ( ls ) now = 0 for loc in range ( 1 , len ( ls ) , 2 ) : now += ls [ loc ] - ls [ loc - 1 ] if now < nat or str ( nat ) == ' False ' : nat = nowprint ( nat ) NEW_LINE

""" Pseudocode : Read ▁ NRead ▁ the ▁ input ( ) , ▁ store ▁ in ▁ a ▁ list : ▁ weightssort ▁ weightsinstability ; for ▁ i ▁ ( 0 , ▁ len ▁ weights ▁ - ▁ 2 , ▁ 2 ) : ▁ ▁ ▁ ▁ instability ▁ = ▁ difference ▁ between ▁ 2print ▁ instability """ N = input ( ) weights = list ( map ( int , input ( ) . split ( ) ) )   weights . sort ( )   minCount = - 1   for i in range ( 0 , len ( weights ) - 1 ) : for j in range ( i + 1 , len ( weights ) ) : count = 0 tempWeights = weights . copy ( ) del tempWeights [ i ] del tempWeights [ j - 1 ]   for k in range ( 0 , len ( tempWeights ) - 1 , 2 ) : count += tempWeights [ k + 1 ] - tempWeights [ k ] if minCount == - 1 or count < minCount : minCount = count   print ( minCount ) NEW_LINE

N = int ( input ( ) ) weight = list ( map ( int , input ( ) . split ( ) ) ) weight . sort ( )   mc = - 1   for i in range ( 0 , len ( weight ) - 1 ) :   for x in range ( i + 1 , len ( weight ) ) : count = 0 tl = weight . copy ( ) tl . pop ( i ) tl . pop ( x - 1 )   for k in range ( 0 , len ( tl ) - 1 , 2 ) : count += tl [ k + 1 ] - tl [ k ] if mc == - 1 : mc = count if count < mc : mc = countprint ( mc ) NEW_LINE

import mathn = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) x = [ ] ans = math . inffor t in range ( 2 * n ) : for k in range ( t , 2 * n ) : c = a [ : ] c = a [ : t ] + a [ t + 1 : k ] + a [ k + 1 : ] for i in range ( 0 , 2 * n - 2 , 2 ) : x . append ( c [ i + 1 ] - c [ i ] ) ans = min ( ans , sum ( x ) ) x = [ ] print ( ans ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int d = s . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = s . nextInt ( ) ; Set < Integer > h = new HashSet < > ( ) ; h . add ( a [ 0 ] - d ) ; h . add ( a [ n - 1 ] + d ) ; int k = 1 ; for ( int j = 0 ; j < n ; j ++ ) { int a1 = a [ j ] - d ; if ( j > 0 && Math . abs ( a1 - a [ j - 1 ] ) >= d ) { h . add ( a1 ) ; } int a2 = a [ j ] + d ; if ( j < n - 1 && Math . abs ( a [ j + 1 ] - a2 ) >= d ) { h . add ( a2 ) ; } } System . out . println ( h . size ( ) ) ; } }

import java . util . Scanner ;   public class SonyaHotels { public static void main ( String [ ] args ) {   Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) , d = in . nextInt ( ) , i , a [ ] = new int [ n ] , c = 0 , l = - 1 ; for ( i = 0 ; i < n ; i ++ ) a [ i ] = in . nextInt ( ) ; in . close ( ) ;   for ( i = 0 ; i < n ; i ++ ) { if ( i == 0 || ( i > 0 && a [ i ] - d >= a [ i - 1 ] + d && a [ i ] - d != l ) ) { c ++ ; l = a [ i ] - d ; } if ( i == n - 1 || ( i < n - 1 && a [ i ] + d <= a [ i + 1 ] - d && a [ i ] + d != l ) ) { c ++ ; l = a [ i ] + d ; } } System . out . println ( c ) ; } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner keyboard = new Scanner ( System . in ) ;   int n , min ; n = keyboard . nextInt ( ) ; min = keyboard . nextInt ( ) ; int [ ] hotel = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { hotel [ i ] = keyboard . nextInt ( ) ; }

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

m , n = map ( int , input ( ) . split ( ) ) s = [ int ( v ) for v in input ( ) . split ( ) ] count = 2 for i in range ( len ( s ) - 1 ) : val = ( abs ( s [ i ] - s [ i + 1 ] ) / ( n * 2 ) ) if val == 1 : count += 1 elif val > 1 : count += 2 else : count += 0 print ( count ) NEW_LINE

n , d = map ( int , ( input ( ) . split ( ) ) )   x = list ( map ( int , input ( ) . split ( ) ) )     count = 2   if n > 1 : for i in range ( 1 , n ) : temp = x [ i ] - x [ i - 1 ] if temp == ( 2 * d ) : count = count + 1 if temp > 2 * d : count = count + 2   print ( count ) NEW_LINE

n , d = list ( map ( int , input ( ) . split ( ) ) ) s = list ( map ( int , input ( ) . split ( ) ) ) t = 2 for i in range ( n - 1 ) : if s [ i + 1 ] - s [ i ] == 2 * d : t += 1 if s [ i + 1 ] - s [ i ] > 2 * d : t += 2 print ( t ) NEW_LINE

n , d = map ( int , input ( ) . split ( ) ) cor = list ( map ( int , input ( ) . split ( ) ) ) count = 2 for i in range ( 1 , len ( cor ) ) : if abs ( cor [ i ] - cor [ i - 1 ] ) > 2 * d : count += 2 elif abs ( cor [ i ] - cor [ i - 1 ] ) == 2 * d : count += 1 else : continue   print ( count ) NEW_LINE

n , d = map ( int , input ( ) . split ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) c = 2 for i in range ( 1 , n ) : if ( li [ i ] - li [ i - 1 ] ) == 2 * d : c = c + 1 if ( li [ i ] - li [ i - 1 ] ) > 2 * d : c = c + 2 print ( c ) NEW_LINE


import javax . print . DocFlavor ; import javax . swing . * ; import java . awt . image . BandedSampleModel ; import java . util . * ;   public class Example { static long [ ] [ ] dp ;

import java . util . * ;   public class Check2 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; long n = sc . nextLong ( ) ; long k = sc . nextLong ( ) ; long [ ] ar = new long [ ( int ) k ] ; int ans = 0 ; long number = 0 ; long diff = Long . MAX_VALUE ;   for ( int i = 0 ; i < k ; i ++ ) { ar [ i ] = sc . nextLong ( ) ; long j1 = n / ar [ i ] ; long d1 = n % ar [ i ] ;

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextLong ( ) ; int k = s . nextInt ( ) ; long a [ ] = new long [ k ] ; long ans = 0 , min = Long . MAX_VALUE ; int index = 0 ; for ( int i = 0 ; i < k ; i ++ ) a [ i ] = s . nextLong ( ) ; for ( int j = 0 ; j < k ; j ++ ) { if ( a [ j ] == n ) { ans = 1 ; break ; } else if ( a [ j ] < n ) { long o = n % a [ j ] ; if ( o < min ) { min = o ; ans = n / a [ j ] ; index = j ; } } } index ++ ; System . out . println ( index + " ▁ " + ans ) ; } }

k , n = map ( int , input ( ) . split ( ) ) r = lambda : list ( map ( int , input ( ) . split ( ) ) ) arr = r ( ) x = float ( ' inf ' )   for pos , i in enumerate ( arr ) : if ( k % i ) < x : x = k % i ans = pos       print ( ans + 1 , k // arr [ ans ] ) NEW_LINE

if __name__ == ' _ _ main _ _ ' : n , k = map ( int , input ( ) . split ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) min1 = 99999999999999999999999999 q = 1 for i in range ( k ) : if n % l [ i ] < min1 : min1 = n % l [ i ] q = i + 1 print ( q , n // l [ q - 1 ] ) NEW_LINE

n , k = [ int ( x ) for x in input ( ) . split ( ) ] capacities = [ int ( x ) for x in input ( ) . split ( ) ] mods = [ n % capacities [ i ] for i in range ( k ) ] min_mod = min ( mods ) index = mods . index ( min_mod ) print ( " { } ▁ { } " . format ( index + 1 , n // capacities [ index ] ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) left = 10 ** 18 ans = 0 for i in range ( k ) : if n % a [ i ] < left : left = n % a [ i ] ans = iprint ( ans + 1 , n // a [ ans ] ) NEW_LINE


import java . util . Scanner ;   public class B1451 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int T = in . nextInt ( ) ; for ( int t = 0 ; t < T ; t ++ ) { int N = in . nextInt ( ) ; int Q = in . nextInt ( ) ; char [ ] S = in . next ( ) . toCharArray ( ) ; for ( int q = 0 ; q < Q ; q ++ ) { int L = in . nextInt ( ) - 1 ; int R = in . nextInt ( ) - 1 ; boolean found = false ; for ( int i = 0 ; i < L ; i ++ ) { if ( S [ L ] == S [ i ] ) { found = true ; } } for ( int i = R + 1 ; i < N ; i ++ ) { if ( S [ R ] == S [ i ] ) { found = true ; } } System . out . println ( found ? " YES " : " NO " ) ; } } }   }

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 q = sc . nextInt ( ) ; String s = sc . next ( ) ; while ( q -- > 0 ) { int l = sc . nextInt ( ) ; int r = sc . nextInt ( ) ; String st = s . substring ( l - 1 , r ) ; int c = l - 1 ; int lis = 0 , ini = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( s . charAt ( c ) == ch ) { if ( c == l - 1 ) ini = i ; else lis = i ; if ( c != r - 1 ) c ++ ; } } if ( ini == l - 1 && lis == r - 1 ) System . out . println ( " NO " ) ; else System . out . println ( " YES " ) ; } } } }

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

import java . util . HashMap ; import java . util . Map ; import java . util . Scanner ; import java . util . Set ;   public class Problem1451B {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; while ( t -- > 0 ) { int n = s . nextInt ( ) ; int q = s . nextInt ( ) ; char arr [ ] = s . next ( ) . toCharArray ( ) ; while ( q -- > 0 ) { int l = s . nextInt ( ) ; int r = s . nextInt ( ) ; if ( ! checkLeft ( l , r , arr ) && ! checkRight ( l , r , arr , n ) ) { System . out . println ( " NO " ) ; continue ; } System . out . println ( " YES " ) ; } } }   private static boolean checkRight ( int l , int r , char [ ] arr , int n ) { char baseRightChar = arr [ r - 1 ] ; for ( int i = r ; i < n ; i ++ ) { if ( arr [ i ] == baseRightChar ) return true ; } return false ; }   private static boolean checkLeft ( int l , int r , char [ ] arr ) { char baseLeftChar = arr [ l - 1 ] ; for ( int i = 0 ; i < l - 1 ; i ++ ) { if ( arr [ i ] == baseLeftChar ) return true ; } return false ; }   }

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

def solve ( s , l , r ) : lind , rind = s . find ( s [ l - 1 ] ) , s . rfind ( s [ r - 1 ] ) NEW_LINE if ( lind != - 1 and rind != - 1 ) : if NEW_LINE INDENT ( rind - lind >= len ( s [ l - 1 : r ] ) ) : NEW_LINE DEDENT return ( " YES " ) else : return ( " NO " ) else : return ( " NO " ) NEW_LINE for i in range ( int ( input ( ) ) ) : n , q = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( ) NEW_LINE for i in range ( q ) : l , r = map ( int , input ( ) . split ( ) ) NEW_LINE print ( solve ( s , l , r ) ) NEW_LINE

get = input     NEW_LINE def solve ( ) : l , q = list ( map ( int , get ( ) . split ( ) ) ) NEW_LINE string = get ( ) NEW_LINE check1 , check2 = False , False NEW_LINE for i in range ( q ) : a , b = list ( map ( int , get ( ) . split ( ) ) ) NEW_LINE if b - a + 1 == l : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE for NEW_LINE DEDENT i in range ( 0 , a - 1 ) : NEW_LINE if string [ i ] == string [ a - 1 ] : print ( " YES " ) NEW_LINE check1 = True NEW_LINE break NEW_LINE if check1 == False : for NEW_LINE i in range ( b , l ) : NEW_LINE if string [ i ] == string [ b - 1 ] : print ( " YES " ) NEW_LINE check2 = True NEW_LINE break NEW_LINE if check1 == False and check2 == False : print ( " NO " )   check1 , check2 = False , False   for i in range ( int ( get ( ) ) ) : solve ( )         NEW_LINE

cases = int ( input ( ) ) NEW_LINE while cases : cases -= 1 NEW_LINE a , b = map ( int , input ( ) . split ( ) ) NEW_LINE s = input ( )   while b : b -= 1 NEW_LINE l , r = ( map ( int , input ( ) . split ( ) ) ) NEW_LINE l , r = l - 1 , r - 1   if s [ : l ] . count ( s [ l ] ) == s [ r + 1 : ] . count ( s [ r ] ) == 0 : NEW_LINE INDENT print ( " NO " ) else : NEW_LINE print ( " YES " ) NEW_LINE DEDENT

T = int ( input ( ) ) NEW_LINE for _ in range ( T ) : n , q = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE s = input ( ) NEW_LINE for _ in range ( q ) : i , j = [ int ( x ) for x in input ( ) . split ( ) ] NEW_LINE sub = s [ i - 1 : j ] NEW_LINE k = 0 NEW_LINE while k < n and sub [ 0 ] != s [ k ] : k += 1 NEW_LINE l = n - 1 NEW_LINE while l >= 0 and sub [ - 1 ] != s [ l ] : l -= 1 NEW_LINE if k != i - 1 or l != j - 1 : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " )   NEW_LINE DEDENT


import java . io . * ; import java . util . StringTokenizer ;   public class C {   public static void main ( String [ ] args ) throws IOException {   Scanner sc = new Scanner ( System . in ) ; PrintWriter out = new PrintWriter ( System . out ) ;   int a = sc . nextInt ( ) * 2 , b = sc . nextInt ( ) * 2 , x1 = sc . nextInt ( ) , y1 = sc . nextInt ( ) , x2 = sc . nextInt ( ) , y2 = sc . nextInt ( ) ; int d1 = Math . abs ( Math . floorDiv ( x1 - y1 , b ) - Math . floorDiv ( x2 - y2 , b ) ) ; int d2 = Math . abs ( Math . floorDiv ( x1 + y1 , a ) - Math . floorDiv ( x2 + y2 , a ) ) ; out . println ( Math . max ( d1 , d2 ) ) ; out . close ( ) ;   }    static class Scanner { StringTokenizer st ; BufferedReader br ;   public Scanner ( InputStream s ) { br = new BufferedReader ( new InputStreamReader ( s ) ) ; }   public String next ( ) throws IOException { while ( st == null || ! st . hasMoreTokens ( ) ) st = new StringTokenizer ( br . readLine ( ) ) ; return st . nextToken ( ) ; }   public int nextInt ( ) throws IOException { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) throws IOException { return Long . parseLong ( next ( ) ) ; }   public String nextLine ( ) throws IOException { return br . readLine ( ) ; }   public boolean ready ( ) throws IOException { return br . ready ( ) ; }    } }

a , b , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) X1 , Y1 = x1 + y1 , x1 - y1X2 , Y2 = x2 + y2 , x2 - y2A , B = 2 * a , 2 * b     def solve ( x , y , z ) : if x >= 0 > y or x < 0 <= y : x = max ( x , - x ) y = max ( y , - y ) tmp = x // z + y // z + 1 return tmp else : if x < y : x , y = y , x tmp = x // z - y // z return tmp     ans1 = solve ( X1 , X2 , A ) ans2 = solve ( Y1 , Y2 , B )   print ( max ( ans1 , ans2 ) ) NEW_LINE

a , b , x1 , y1 , x2 , y2 = map ( int , input ( ) . split ( ) ) X1 , Y1 = x1 + y1 , x1 - y1X2 , Y2 = x2 + y2 , x2 - y2A , B = 2 * a , 2 * b     def solve ( x , y , z ) : if x >= 0 > y or x < 0 <= y : x = max ( x , - x ) y = max ( y , - y ) tmp = x // z - ( x % z == 0 ) + y // z - ( y % z == 0 ) + 1 return tmp else : if x < y : x , y = y , x tmp = x // z - ( x % z == 0 ) - y // z - ( y % z == 0 ) return tmp     ans1 = solve ( X1 , X2 , A ) ans2 = solve ( Y1 , Y2 , B )   print ( max ( ans1 , ans2 ) ) NEW_LINE


import java . util . * ;    public class Practise {

import java . util . Scanner ;   public class _0643MagicSticks {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; if ( x == 2 && y > 3 ) { System . out . println ( " NO " ) ; } else if ( x == 3 && y > 3 ) { System . out . println ( " NO " ) ; } else if ( x == 1 && y > 1 ) { System . out . println ( " NO " ) ; } else { System . out . println ( " YES " ) ; } cases -- ; } }   }

import java . util . * ;   public class Test { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ;   while ( t -- > 0 ) {   int x = input . nextInt ( ) ; int y = input . nextInt ( ) ; boolean result = true ;   if ( ( x < 4 && y > 3 ) || ( x == 1 && y > x ) ) { result = false ; } System . out . println ( result ? " YES " : " NO " ) ; } } }

ll = lambda : map ( int , input ( ) . split ( ) ) t = lambda : int ( input ( ) ) ss = lambda : input ( ) lx = lambda x : map ( int , input ( ) . split ( x ) ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : x , y = map ( int , input ( ) . split ( ) ) if x >= y : print ( ' YES ' ) else : if x == 2 and y == 3 or x >= 4 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : s = input ( ) l = s . split ( ) x = int ( l [ 0 ] ) y = int ( l [ 1 ] ) if x >= 4 or x >= y or ( x == 2 and y == 3 ) : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : x , y = map ( int , input ( ) . split ( ) ) if x > 3 : print ( " YES " ) elif x == 1 : if y == 1 : print ( " YES " ) else : print ( " NO " ) else : if y <= 3 : print ( " YES " ) else : print ( " NO " ) NEW_LINE

import sysinput = sys . stdin . readline   for test in range ( int ( input ( ) ) ) : x , y = [ int ( i ) for i in input ( ) . split ( ) ] if x == 1 : print ( " YES " if y == 1 else " NO " ) elif x <= 3 : print ( " YES " if 1 <= y <= 3 else " NO " ) else : print ( " YES " ) NEW_LINE


import java . util . Scanner ;   public class antonDigits {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k2 = sc . nextInt ( ) ; int k3 = sc . nextInt ( ) ; int k5 = sc . nextInt ( ) ; int k6 = sc . nextInt ( ) ;   int ans = 0 ; int temp = Math . min ( k2 , Math . min ( k5 , k6 ) ) ; k2 -= temp ; k5 -= temp ; k6 -= temp ; ans += temp * 256 ; temp = Math . min ( k3 , k2 ) ; ans += temp * 32 ; System . out . println ( ans ) ; }   }

import java . util . * ; import java . io . * ; import java . lang . Math . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int k2 = sc . nextInt ( ) ; int k3 = sc . nextInt ( ) ; int k5 = sc . nextInt ( ) ; int k6 = sc . nextInt ( ) ; int a = Math . min ( k2 , ( Math . min ( k5 , k6 ) ) ) ; k2 = k2 - a ; int b = Math . min ( k2 , k3 ) ; long val = 256 * a + 32 * b ; System . out . println ( val ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class FindingBorders {   public static void main ( String [ ] args ) throws Exception {

import java . io . * ; import java . math . BigInteger ; import java . util . * ;   public class Train { static class InputReader { BufferedReader reader ; StringTokenizer tokenizer ;   public InputReader ( InputStream stream ) { reader = new BufferedReader ( new InputStreamReader ( stream ) , 32768 ) ; tokenizer = null ; }   String next ( ) { while ( tokenizer == null || ! tokenizer . hasMoreTokens ( ) ) { try { tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ;   } }   return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   }    static InputReader kb = new InputReader ( System . in ) ; static PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { int k2 = kb . nextInt ( ) ; int k3 = kb . nextInt ( ) ; int k5 = kb . nextInt ( ) ; int k6 = kb . nextInt ( ) ;   int n_5 = Math . min ( Math . min ( k2 , k5 ) , k6 ) ; int n_3 = Math . min ( k3 , k2 - n_5 ) ; System . out . println ( 256 * n_5 + n_3 * 32 ) ;   } }

import java . util . Scanner ;   public class AntonAndDigits { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n2 = scanner . nextInt ( ) ; int n3 = scanner . nextInt ( ) ; int n5 = scanner . nextInt ( ) ; int n6 = scanner . nextInt ( ) ;    int n256 = Math . min ( Math . min ( n2 , n5 ) , n6 ) ;   n2 -= n256 ; n5 -= n256 ; n6 -= n256 ;   int n32 = Math . min ( n2 , n3 ) ;   System . out . println ( 256 * n256 + 32 * n32 ) ; } }

a , b , c , d = map ( int , input ( ) . split ( ) ) k = min ( a , c , d ) a -= kt = min ( a , b ) print ( 256 * k + 32 * t ) NEW_LINE

k = list ( map ( int , input ( ) . split ( ) ) ) max_nums = ( min ( k [ 0 ] , k [ 2 ] , k [ 3 ] ) ) v = max_nums * 256 if k [ 0 ] - max_nums > k [ 1 ] : s = k [ 1 ] * 32 else : s = ( k [ 0 ] - max_nums ) * 32 print ( v + s ) NEW_LINE

import sysinput = sys . stdin . readline   '''   '''     k2 , k3 , k5 , k6 = map ( int , input ( ) . split ( ) ) num_256 = min ( k2 , min ( k5 , k6 ) ) k2 -= num_256num_32 = min ( k2 , k3 ) print ( num_256 * 256 + num_32 * 32 ) NEW_LINE

k2 , k3 , k5 , k6 = map ( int , input ( ) . split ( ) ) a = k2b = k3c = k5d = k6p = min ( a , c , d ) a -= pq = min ( a , b ) print ( ( p * 256 ) + ( q * 32 ) ) NEW_LINE

a = [ int ( x ) for x in input ( ) . split ( ) ] ans = 0 minimum = min ( a [ 0 ] , a [ 2 ] , a [ 3 ] ) ans += 256 * minimuma [ 0 ] -= minimuma [ 2 ] -= minimuma [ 3 ] -= minimumminimum = min ( a [ 0 ] , a [ 1 ] ) ans += 32 * minimumprint ( ans ) NEW_LINE


# include < bits / stdc ++ . h >   const int MAXN = 1e5 + 5 ;   int m , q [ MAXN ] , n , a [ MAXN ] , f [ MAXN ] , exist [ MAXN ] , min = 0x7fffffff ; int sum [ MAXN ] ;   int main ( ) { scanf ( " % d " , & m ) ; for ( int i = 1 ; i <= m ; i ++ ) scanf ( " % d " , q + i ) , min = std :: min ( min , q [ i ] ) ; scanf ( " % d " , & n ) ; for ( int i = 1 ; i <= n ; i ++ ) scanf ( " % d " , a + i ) ; std :: sort ( a + 1 , a + n + 1 , [ ] ( int a , int b ) -> bool { return a > b ; } ) ; std :: sort ( q + 1 , q + m + 1 ) ; for ( int i = 1 ; i <= n ; i ++ ) sum [ i ] = sum [ i - 1 ] + a [ i ] ; f [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { f [ i ] = f [ i - 1 ] + a [ i ] ; if ( i - min - 1 >= 0 ) f [ i ] = std :: min ( f [ i ] , f [ i - min - 1 ] - sum [ i - min - 1 ] + sum [ i - 1 ] ) ; if ( i - min - 2 >= 0 ) f [ i ] = std :: min ( f [ i ] , f [ i - min - 2 ] - sum [ i - min - 2 ] + sum [ i - 2 ] ) ; } printf ( " % d \n " , f [ n ] ) ; return 0 ; }

import java . util . * ; import java . lang . * ; import java . math . * ; import java . io . * ; import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . text . DecimalFormat ; import java . lang . Math ; import java . util . Iterator ; public class C47 { static class Pair implements Comparable < Pair > { int v ; int i ; public Pair ( int v , int i ) { this . v = v ; this . i = i ; } @ Override public int compareTo ( Pair o ) {

input ( ) I = lambda : map ( int , input ( ) . split ( ) ) q , n , a , r , k = min ( I ( ) ) , int ( input ( ) ) - 1 , sorted ( I ( ) ) , 0 , 0 while n > - 1 : r += a [ n ] k += 1 if k == q : n -= 3 ; k = 0 else : n -= 1 print ( r ) NEW_LINE

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

m = int ( input ( ) ) q = list ( map ( int , input ( ) . split ( ) ) ) c = min ( q ) n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) res = 0 for i in range ( n ) : if i % ( c + 2 ) < c : res += a [ n - 1 - i ] print ( res ) NEW_LINE

I = lambda : map ( int , input ( ) . split ( ) ) m , q , n , a , r , k = int ( input ( ) ) , min ( I ( ) ) , int ( input ( ) ) - 1 , sorted ( I ( ) ) , 0 , 0 while n > - 1 : r += a [ n ] k += 1 if k == q : n -= 3 ; k = 0 else : n -= 1 print ( r ) NEW_LINE


import java . io . BufferedReader ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . StringTokenizer ; import java . util . TreeSet ; import java . io . InputStreamReader ; import java . io . IOException ; public class codeforces { public static void main ( String [ ] args ) { scanner in = new scanner ( ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; ArrayList < Integer > no = new ArrayList < > ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) no . add ( in . nextInt ( ) ) ; if ( n >= 5 && k >= n + 1 ) { System . out . print ( no . get ( 0 ) + " ▁ " + no . get ( 2 ) + " ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( ! no . contains ( i ) ) System . out . print ( i + " ▁ " ) ; System . out . println ( no . get ( 3 ) + " ▁ " + no . get ( 1 ) + " ▁ " ) ; System . out . print ( no . get ( 2 ) + " ▁ " + no . get ( 0 ) + " ▁ " ) ; for ( int i = 1 ; i <= n ; i ++ ) if ( ! no . contains ( i ) ) System . out . print ( i + " ▁ " ) ; System . out . println ( no . get ( 1 ) + " ▁ " + no . get ( 3 ) + " ▁ " ) ; } else System . out . println ( - 1 ) ; } } class scanner { BufferedReader br ; StringTokenizer st ; public scanner ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; st = null ; } public String next ( ) { while ( st == null || ! 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 ( ) ) ; } }

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

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

import java . util . Scanner ;    public class Main {   public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ;   int n , k ; n = scanner . nextInt ( ) ; k = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; int [ ] vis = new int [ n + 1 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; vis [ arr [ i ] ] = 1 ; } if ( k < n + 1 || n == 4 ) { System . out . println ( - 1 ) ; return ; } int indx = 4 , vrtx = 1 ; while ( indx < n ) { while ( vis [ vrtx ] == 1 ) { vrtx ++ ; } arr [ indx ++ ] = vrtx ; vis [ vrtx ] = 1 ; }

import java . io . * ; import java . util . * ;    public class GFG { public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; int n = fr . nextInt ( ) , k = fr . nextInt ( ) ; int a = fr . nextInt ( ) , b = fr . nextInt ( ) , c = fr . nextInt ( ) , d = fr . nextInt ( ) ; if ( k < n + 1 || n == 4 ) { System . out . println ( " - 1" ) ; } else { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i != a && i != b && i != c && i != d ) { sb . append ( i + " ▁ " ) ; } } String first = a + " ▁ " + c + " ▁ " + sb . toString ( ) + d + " ▁ " + b ; String second = c + " ▁ " + a + " ▁ " + sb . toString ( ) + b + " ▁ " + d ; System . out . println ( first ) ; System . out . println ( second ) ; } } } class FastReader { BufferedReader bf ; StringTokenizer st ; public FastReader ( ) { bf = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( bf . readLine ( ) ) ; } catch ( Exception e ) { System . out . println ( e ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = bf . readLine ( ) ; } catch ( Exception e ) { System . out . println ( e ) ; } return str ; } }

n , k = map ( int , input ( ) . split ( ) ) a , b , c , d = input ( ) . split ( ) if n < 5 or k < n + 1 : print ( - 1 ) else : l = list ( set ( map ( str , range ( 1 , n + 1 ) ) ) - { a , b , c , d } ) print ( ' ▁ ' . join ( [ a , c ] + l + [ d , b ] + [ c , a ] + l + [ b , d ] ) ) NEW_LINE

f = lambda : map ( int , input ( ) . split ( ) ) n , k = f ( ) a , b , c , d = f ( ) s = list ( set ( range ( 1 , n + 1 ) ) . difference ( { a , b , c , d } ) ) d = [ a , c ] + s + [ d , b ] + [ c , a ] + s + [ b , d ] print ( ' ▁ ' . join ( map ( str , d ) ) if 4 < n < k else - 1 ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a , b , c , d = map ( int , input ( ) . split ( ) ) B = [ ] for i in range ( 1 , n + 1 ) : if i not in ( a , b , c , d ) : B . append ( i ) else : i -= 1 A = [ a , c ] + B + [ d , b ] C = [ c , a ] + B + [ b , d ] R = set ( ) for i in range ( n - 1 ) : R . add ( tuple ( sorted ( ( A [ i ] , A [ i + 1 ] ) ) ) ) R . add ( tuple ( sorted ( ( C [ i ] , C [ i + 1 ] ) ) ) ) if tuple ( sorted ( ( a , b ) ) ) in R : print ( - 1 ) exit ( ) if tuple ( sorted ( ( c , d ) ) ) in R : print ( - 1 ) exit ( ) if len ( R ) > k : print ( - 1 ) exit ( ) print ( * A ) print ( * C ) NEW_LINE

import sysprint = sys . stdout . writen , k = map ( int , input ( ) . split ( ) ) a , b , c , d = map ( int , input ( ) . split ( ) ) if n == 4 or k < n + 1 : print ( " - 1 \n " ) exit ( ) E = ( a , b , c , d ) print ( f " { a } ▁ { c } ▁ " ) for i in range ( 1 , n + 1 ) : if i not in E : print ( f " { i } ▁ " ) print ( f " { d } ▁ { b } \n " ) print ( f " { c } ▁ { a } ▁ " ) for i in range ( 1 , n + 1 ) : if i not in E : print ( f " { i } ▁ " ) print ( f " { b } ▁ { d } \n " ) NEW_LINE


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

import java . util . Arrays ; import java . util . Scanner ;   public class Game { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int [ ] point = new int [ 6 ] ; for ( int i = 0 ; i < 6 ; i ++ ) point [ i ] = input . nextInt ( ) ;   if ( right ( point ) ) System . out . println ( " RIGHT " ) ; else if ( almostRight ( point ) ) System . out . println ( " ALMOST " ) ; else System . out . println ( " NEITHER " ) ; } public static boolean right ( int [ ] points ) { int [ ] sides = new int [ 3 ] ; Arrays . fill ( sides , 0 ) ; sides [ 0 ] = ( points [ 4 ] - points [ 2 ] ) * ( points [ 4 ] - points [ 2 ] ) + ( points [ 5 ] - points [ 3 ] ) * ( points [ 5 ] - points [ 3 ] ) ; sides [ 1 ] = ( points [ 4 ] - points [ 0 ] ) * ( points [ 4 ] - points [ 0 ] ) + ( points [ 5 ] - points [ 1 ] ) * ( points [ 5 ] - points [ 1 ] ) ; sides [ 2 ] = ( points [ 2 ] - points [ 0 ] ) * ( points [ 2 ] - points [ 0 ] ) + ( points [ 3 ] - points [ 1 ] ) * ( points [ 3 ] - points [ 1 ] ) ; Arrays . sort ( sides ) ; if ( sides [ 0 ] > 0 && sides [ 2 ] == sides [ 0 ] + sides [ 1 ] ) return true ; return false ; } public static boolean almostRight ( int [ ] points ) { for ( int i = 0 ; i < 6 ; i ++ ) { points [ i ] -- ; if ( right ( points ) ) return true ; points [ i ] ++ ; points [ i ] ++ ; if ( right ( points ) ) return true ; points [ i ] -- ; }   return false ; } }

import java . util . * ; import java . util . Scanner ; import java . io . * ; import javax . lang . model . util . ElementScanner6 ; import static java . lang . System . out ; import java . util . Stack ; import java . util . Queue ; import java . util . LinkedList ;   public class A18 {   static int mod = ( int ) ( 1e9 + 7 ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static FastReader in = new FastReader ( ) ; static PrintWriter pr = new PrintWriter ( new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ) ; public static void main ( String args [ ] ) {   int tc = 1 ;

def isRight ( a ) : x1 , y1 , x2 , y2 , x3 , y3 = a   if ( x1 == x2 and y1 == y2 ) or ( x1 == x3 and y1 == y3 ) or ( x2 == x3 and y2 == y3 ) : return False   A = ( y2 - y1 ) ** 2 + ( x2 - x1 ) ** 2 B = ( y3 - y1 ) ** 2 + ( x3 - x1 ) ** 2 C = ( y3 - y2 ) ** 2 + ( x3 - x2 ) ** 2   check = [ A , B , C ] check . sort ( )   return ( check [ 0 ] + check [ 1 ] == check [ 2 ] )   a = [ int ( x ) for x in input ( ) . split ( ) ]   if isRight ( a ) : print ( " RIGHT " ) else : isOk = False     for i in range ( 0 , 6 ) : a [ i ] += 1 isOk = isOk or isRight ( a ) a [ i ] -= 1   for i in range ( 0 , 6 ) : a [ i ] += - 1 isOk = isOk or isRight ( a ) a [ i ] -= - 1   if ( isOk ) : print ( " ALMOST " )   else : print ( " NEITHER " ) NEW_LINE

import sysdef check ( a1 , a2 , b1 , b2 , c1 , c2 ) : x = ( a1 - b1 ) ** 2 + ( a2 - b2 ) ** 2 y = ( b1 - c1 ) ** 2 + ( c2 - b2 ) ** 2 z = ( a1 - c1 ) ** 2 + ( c2 - a2 ) ** 2 l1 = [ x , y , z ] l1 . sort ( ) if l1 [ 0 ] + l1 [ 1 ] == l1 [ 2 ] and x != 0 and y != 0 and z != 0 : return True else : return Falsea1 , a2 , b1 , b2 , c1 , c2 = map ( int , input ( ) . split ( ) ) if check ( a1 , a2 , b1 , b2 , c1 , c2 ) : print ( " RIGHT " ) elif check ( a1 + 1 , a2 , b1 , b2 , c1 , c2 ) or check ( a1 - 1 , a2 , b1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 + 1 , b1 , b2 , c1 , c2 ) or check ( a1 , a2 - 1 , b1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 + 1 , b2 , c1 , c2 ) or check ( a1 , a2 , b1 - 1 , b2 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 + 1 , c1 , c2 ) or check ( a1 , a2 , b1 , b2 - 1 , c1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 , c1 + 1 , c2 ) or check ( a1 , a2 , b1 , b2 , c1 - 1 , c2 ) : print ( " ALMOST " ) elif check ( a1 , a2 , b1 , b2 , c1 , c2 + 1 ) or check ( a1 , a2 , b1 , b2 , c1 , c2 - 1 ) : print ( " ALMOST " ) else : print ( " NEITHER " ) NEW_LINE


import java . util . * ;   public class cf180 { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int i = 0 ; String s = sc . next ( ) ; int f [ ] = new int [ 26 ] ; for ( i = 0 ; i < n ; i ++ ) { char ch = s . charAt ( i ) ; f [ ch - ' a ' ] ++ ; } long ans = 0 ;

import java . util . * ; import java . util . stream . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; scan . nextLine ( ) ; String s = scan . nextLine ( ) ; Set < Character > sch = new HashSet < Character > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { sch . add ( s . charAt ( i ) ) ; } List < Character > li = new ArrayList < Character > ( sch ) ; Collections . sort ( li ) ;

import java . util . * ; import java . io . * ; public class MyClass { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) , st = 0 , sum = 0 ; int arr [ ] = new int [ 26 ] ; String str = sc . next ( ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ str . charAt ( i ) - 97 ] += 1 ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] > 0 ) { st += 1 ; sum += ( i + 1 ) ; if ( st == k ) break ; i += 1 ; } } if ( st == k ) System . out . println ( sum ) ; else System . out . println ( - 1 ) ; sc . close ( ) ; } }

import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int n = s . nextInt ( ) ; int k = s . nextInt ( ) ; s . nextLine ( ) ; String s1 = s . nextLine ( ) ; char d [ ] = { ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' , ' h ' , ' i ' , ' j ' , ' k ' , ' l ' , ' m ' , ' n ' , ' o ' , ' p ' , ' q ' , ' r ' , ' s ' , ' t ' , ' u ' , ' v ' , ' w ' , ' x ' , ' y ' , ' z ' } ; String y [ ] = s1 . split ( " " ) ; Arrays . sort ( y ) ; String result = " " ; for ( String x : y ) result = result + x ; int count = 1 , found = 0 ; int weight = Arrays . binarySearch ( d , result . charAt ( 0 ) ) + 1 ;

n , k = map ( int , input ( ) . split ( ) ) s = sorted ( input ( ) ) last = ord ( ' a ' ) - 2 ans , len = 0 , 0 for i in range ( 0 , n ) : if ord ( s [ i ] ) >= last + 2 : last = ord ( s [ i ] ) ans += ord ( s [ i ] ) - ord ( ' a ' ) + 1 len += 1 if ( len >= k ) : print ( ans ) exit ( )     print ( - 1 ) NEW_LINE

import mathn , k = map ( int , input ( ) . split ( ) ) s = str ( input ( ) )   s = sorted ( s ) NEW_LINE

stages , length = list ( map ( int , input ( ) . split ( ) ) )   s = list ( input ( ) ) s = list ( set ( s ) )   s . sort ( ) weight = 0 flag = 1 next_stage = s [ 0 ] start = 0 end = len ( s )   while length > 0 : length -= 1 if ( next_stage in s and flag == 1 ) : weight += ord ( next_stage ) - 96 flag = 1 if ( length > 0 ) : for each in range ( start , end ) : flag = 0 if ( ord ( s [ each ] ) - ord ( next_stage ) > 1 ) : start = each flag = 1 next_stage = s [ each ] break else : flag = 0 break   if ( flag == 1 ) : print ( weight ) else : print ( - 1 ) NEW_LINE

n , k = list ( map ( int , input ( ) . split ( ) ) ) s = sorted ( list ( str ( input ( ) ) ) ) r = 0 c = 0 m = sorted ( list ( set ( s ) ) ) for i in range ( len ( m ) ) : if i == 0 : r += ( ord ( m [ i ] ) - 96 ) c += 1 t = m [ i ] else : if ord ( m [ i ] ) - ord ( t ) != 1 : r += ( ord ( m [ i ] ) - 96 ) c += 1 t = m [ i ] if c == k : breakprint ( - 1 if c != k else r ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) s = sorted ( input ( ) ) t = ' ' p = ' ▁ ' for c in s : if ord ( c ) > ord ( p ) + 1 : t += c p = c ans = - 1 if len ( t ) >= k : ans = sum ( map ( lambda x : ord ( x ) - 96 , t [ : k ] ) ) print ( ans ) NEW_LINE