import com . sun . org . apache . bcel . internal . generic . AALOAD ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigInteger ; import java . util . * ; import java . util . stream . IntStream ; import javafx . util . Pair ;   public class Main {   public static void main ( String [ ] args ) throws IOException {   Scanner input = new Scanner ( System . in ) ; long n , a , b , c ; n = input . nextLong ( ) ;

import java . util . * ; import java . lang . * ; import java . io . * ;   public final class alyona { public static void main ( String [ ] args ) throws java . lang . Exception { Reader r = new Reader ( ) ; r . init ( System . in ) ; long n = r . nextInt ( ) ; long a = r . nextInt ( ) ; long b = r . nextInt ( ) ; long c = r . nextInt ( ) ; long buy = ( 4 - ( n % 4 ) ) % 4 ; long ans = 0 ; if ( buy == 1 ) { ans = Math . min ( a , Math . min ( b + c , 3 * c ) ) ; } else if ( buy == 2 ) { ans = Math . min ( 2 * a , Math . min ( b , c * 2 ) ) ; } else if ( buy == 3 ) { ans = Math . min ( a * 3 , Math . min ( c , a + b ) ) ; } else { ans = 0 ; } System . out . println ( ans ) ;   }   static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; }   static class Reader { static BufferedReader reader ; static StringTokenizer tokenizer ; static void init ( InputStream input ) { reader = new BufferedReader ( new InputStreamReader ( input ) ) ; tokenizer = new StringTokenizer ( " " ) ; } static String next ( ) throws IOException { while ( ! tokenizer . hasMoreTokens ( ) ) {

import java . util . Scanner ;   public class P740A {   public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; long n = s . nextLong ( ) ; long a = s . nextLong ( ) ; long b = s . nextLong ( ) ; long c = s . nextLong ( ) ; if ( n % 4 == 0 ) { System . out . println ( 0 ) ; } else { long min = Long . MAX_VALUE ; for ( int i = 0 ; i < 5 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { for ( int k = 0 ; k < 5 ; k ++ ) { if ( ( n + 1 * i + 2 * j + 3 * k ) % 4 == 0 ) { long cost = a * i + b * j + c * k ; min = Math . min ( min , cost ) ; } } } } System . out . println ( min ) ; } } }

n , a , b , c = map ( int , input ( ) . split ( ) ) if ( n % 4 == 0 ) : print ( 0 ) else : hf = ( ( n // 4 ) * 4 ) + 4 diff = hf - n if ( diff == 1 ) : print ( min ( a , b + c , 3 * c ) ) elif ( diff == 2 ) : print ( min ( 2 * a , 2 * c , b ) ) else : print ( min ( c , 3 * a , a + b ) ) NEW_LINE

s = list ( map ( int , input ( ) . split ( ) ) ) n = s [ 0 ] a = s [ 1 ] b = s [ 2 ] c = s [ 3 ] if n % 4 == 0 : print ( 0 ) elif n % 4 == 3 : print ( min ( a * 1 , 3 * c , c + b ) ) elif n % 4 == 2 : print ( min ( 2 * a , b , 2 * c ) ) else : print ( min ( 3 * a , b + a , c ) ) NEW_LINE

n , a , b , c = [ int ( i ) for i in input ( ) . split ( ) ] if ( n % 4 == 0 ) : print ( "0" ) elif ( n % 4 == 1 ) : print ( min ( c , min ( a + b , 3 * a ) ) ) elif ( n % 4 == 2 ) : print ( min ( b , min ( 2 * a , 2 * c ) ) ) else : print ( min ( a , min ( b + c , 3 * c ) ) ) NEW_LINE

a , b , c , d = map ( int , input ( ) . split ( ) ) s = a % 4 h = 0   if s == 3 : h = min ( b , 3 * d , c + d ) elif s == 2 : h = min ( 2 * b , c , 2 * d ) elif s == 1 : h = min ( 3 * b , c + b , d ) print ( h ) NEW_LINE


import java . io . * ; import java . util . * ; import java . math . BigInteger ;   public class test { static class sort implements Comparator < int [ ] >

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 ) { long n = input . nextLong ( ) ; long q = input . nextLong ( ) ; for ( int i = 0 ; i < q ; i ++ ) { long x = input . nextLong ( ) ; if ( x % 2 != 0 ) { out . println ( x / 2 + 1 ) ; } else { long d = n - 1 ; long y = x / 2 ; d = d - ( y - 1 ) ; while ( true ) { x = x + d ; if ( d % 2 != 0 ) { break ; } d = d / 2 ; } out . println ( x / 2 + 1 ) ; } } } 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 . 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 . * ; public class Abc { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long n = in . nextLong ( ) ; int Q = in . nextInt ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { long p = in . nextLong ( ) ; long half = ( n % 2 == 0 ) ? n / 2 : n / 2 + 1 ;   if ( p % 2 == 1 ) { System . out . println ( ( p + 1 ) / 2 ) ; } else { long jump = n - 1 ; jump -= p / 2 - 1 ;

import sysinput = sys . stdin . readline   n , q = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( q ) : a = int ( input ( ) ) if a % 2 != 0 : print ( ( a + 1 ) // 2 ) else : b = a // 2 while 1 > 0 : a = a + ( n - b ) b = a // 2 if a % 2 != 0 : print ( ( a + 1 ) // 2 ) break NEW_LINE

''' ▁ CODED ▁ WITH ▁ LOVE ▁ BY ▁ SATYAM ▁ KUMAR ▁ '''   from sys import stdin , stdoutimport heapqimport cProfile , mathfrom collections import Counter , defaultdict , dequefrom bisect import bisect_left , bisect , bisect_rightimport itertoolsfrom copy import deepcopyfrom fractions import Fractionimport sys , threadingimport operator as opfrom functools import reduceimport sys   sys . setrecursionlimit ( 10 ** 6 ) NEW_LINE

from sys import * input = stdin . readlinen , q = map ( int , input ( ) . split ( ) ) for _ in range ( q ) : i = int ( input ( ) ) while i % 2 == 0 : i += n - i // 2 print ( ( i + 1 ) // 2 ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int i = n + 1 ; int j , f ; while ( true ) { f = 1 ; for ( j = 2 ; j <= i / 2 ; j ++ ) { if ( i % j == 0 ) f = 0 ; } if ( f == 1 ) break ; i ++ ; } if ( i == m ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; } }

import java . io . DataInputStream ; import java . io . FileInputStream ; import java . io . IOException ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Scanner ; import java . lang . String ;   public class Main { static class point { long val , time , t3 ;   point ( long val , long time , int t3 ) { this . val = val ; this . time = time ;   this . t3 = t3 ; } } static class Reader { final private int BUFFER_SIZE = 1 << 16 ; private DataInputStream din ;   private byte [ ] buffer ; private int bufferPointer , bytesRead ;   public Reader ( ) { din = new DataInputStream ( System . in ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public Reader ( String file_name ) throws IOException { din = new DataInputStream ( new FileInputStream ( file_name ) ) ; buffer = new byte [ BUFFER_SIZE ] ; bufferPointer = bytesRead = 0 ; }   public String readLine ( ) throws IOException { byte [ ] buf = new byte [ 64 ] ;

import java . util . Scanner ;   public class A_Panoramix_s_Prediction {   static boolean isPrime ( int n ) { int c = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( n % i == 0 ) c ++ ; } if ( c == 2 ) return true ; return false ; }   static String solve ( ) { int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( isPrime ( n ) && isPrime ( m ) ) { for ( int i = n + 1 ; i < m ; i ++ ) { if ( isPrime ( i ) ) return " NO " ; } return " YES " ; } return " NO " ; }   static Scanner sc = new Scanner ( System . in ) ; public static void main ( String arg [ ] ) { System . out . println ( solve ( ) ) ; } }

l = [ 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 ] NEW_LINE x , y = map ( int , input ( ) . split ( ) ) NEW_LINE if ( l [ l . index ( x ) + 1 ] == y ) : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT

x = input ( ) NEW_LINE n , m = x . split ( ) NEW_LINE n , m = int ( n ) , int ( m )   NEW_LINE def is_prime ( number ) : for NEW_LINE i in range ( 2 , number ) : NEW_LINE if ( number % i == 0 ) : return False NEW_LINE return True   for i in range ( n + 1 , m + 1 ) : if NEW_LINE ( is_prime ( i ) ) : NEW_LINE if ( i == m ) : NEW_LINE INDENT print ( " YES " ) else : NEW_LINE print ( " NO " ) NEW_LINE DEDENT break elif ( i == m ) : print ( " NO " )   NEW_LINE

import math   NEW_LINE def sieve ( n ) : nums = [ - 1 , - 1 ] + list ( range ( 2 , n + 1 ) ) NEW_LINE

n , m = [ int ( i ) for i in input ( ) . split ( ) ]   n += 1   while True : c = 0 NEW_LINE for i in range ( 1 , n ) : if NEW_LINE n % i == 0 : c += 1 NEW_LINE if c == 1 : if NEW_LINE n == m : print ( " YES " ) else : print ( " NO " ) NEW_LINE break NEW_LINE n += 1 NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class First {   public static void process ( ) throws IOException { int n = ni ( ) ; String str = nln ( ) ; int R = 0 , B = 0 , G = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char c = str . charAt ( i ) ; if ( c == ' R ' ) { R ++ ; } else if ( c == ' G ' ) { G ++ ; } else { B ++ ; } }

n = int ( input ( ) )   s = input ( )   l = len ( s ) letters = set ( s )   all_letters = { ' B ' , ' G ' , ' R ' }   if len ( letters ) == 3 : print ( ' ' . join ( all_letters ) ) elif len ( letters ) == 2 : if l == 2 : print ( ' ' . join ( sorted ( all_letters - letters ) ) ) else : a , b = letters count_a = s . count ( a ) count_b = s . count ( b ) if count_a >= 2 and count_b >= 2 : print ( ' ' . join ( all_letters ) ) elif count_a > count_b : print ( ' ' . join ( sorted ( ( all_letters - letters ) . union ( b ) ) ) ) elif count_b > count_a : print ( ' ' . join ( sorted ( ( all_letters - letters ) . union ( a ) ) ) ) else : print ( ' ' . join ( letters ) ) NEW_LINE

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

n = int ( input ( ) ) s = input ( ) d = { ' B ' : 0 , ' G ' : 0 , ' R ' : 0 } for c in s : d [ c ] += 1 vl = d . values ( ) b = max ( vl ) s = min ( vl ) ss = sum ( vl ) if s > 0 or ( b != ss and ss - b > 1 ) : NEW_LINE

from sys import stdin , stdoutn = int ( stdin . readline ( ) ) s = stdin . readline ( ) [ : - 1 ] c1 = 0 c2 = 0 c3 = 0 for i in s : if i == ' R ' : c1 += 1 elif i == ' B ' : c2 += 1 else : c3 += 1 if ( c1 > 0 and c2 > 0 and c3 > 0 ) or ( c1 > 1 and c2 > 1 ) or ( c1 > 1 and c3 > 1 ) or ( c2 > 1 and c3 > 1 ) : print ( ' BGR ' ) elif c1 > 0 : if c2 > 1 : print ( ' GR ' ) elif c3 > 1 : print ( ' BR ' ) elif ( c2 == 1 or c3 == 1 ) and c1 > 1 : print ( ' BG ' ) elif c2 == 1 and c1 == 1 : print ( ' G ' ) elif c1 == 1 and c3 == 1 : print ( ' B ' ) else : print ( ' R ' ) elif c2 > 0 : if c3 > 1 : print ( ' BR ' ) elif c2 > 1 and c3 == 1 : print ( ' GR ' ) elif c2 == 1 and c3 == 1 : print ( ' R ' ) else : print ( ' B ' ) else : print ( ' G ' )       NEW_LINE

from collections import Counter input ( ) F = Counter ( input ( ) ) if len ( F ) < 2 : print ( * F ) elif len ( F ) > 2 : print ( ' BGR ' ) else : f1 , f2 = F . values ( ) if f1 == f2 == 1 : print ( ( set ( ' BGR ' ) - set ( F . keys ( ) ) ) . pop ( ) ) elif f1 > 1 and f2 > 1 : print ( ' BGR ' ) else : print ( * ( c for c in ' BGR ' if c not in F or F [ c ] == 1 ) , sep = ' ' ) NEW_LINE


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int cases = scanner . nextInt ( ) ;   for ( int i = 0 ; i < cases ; i ++ ) { int r = scanner . nextInt ( ) ; int g = scanner . nextInt ( ) ; int b = scanner . nextInt ( ) ;   int sum = ( r + g + b ) / 2 ;   sum = Math . min ( sum , r + g ) ; sum = Math . min ( sum , r + b ) ; sum = Math . min ( sum , g + b ) ;   System . out . println ( sum ) ; } } }

import java . util . Arrays ; import java . util . Scanner ;   public class SweetProblem { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int testCase = scanner . nextInt ( ) ; for ( int i = 0 ; i < testCase ; i ++ ) { int [ ] numbers = new int [ 3 ] ; for ( int j = 0 ; j < numbers . length ; j ++ ) { numbers [ j ] = scanner . nextInt ( ) ; } solve ( numbers ) ; }   }   public static void solve ( int [ ] numbers ) { Arrays . sort ( numbers ) ; if ( numbers [ 2 ] >= numbers [ 0 ] + numbers [ 1 ] ) System . out . println ( numbers [ 0 ] + numbers [ 1 ] ) ; else System . out . println ( ( int ) Math . floor ( ( double ) ( numbers [ 0 ] + numbers [ 1 ] + numbers [ 2 ] ) / 2 ) ) ; } }

import javafx . scene . transform . Scale ; import java . util . Arrays ; import java . util . Scanner ; public class sweetProblem { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int num = scanner . nextInt ( ) ; for ( int s = 0 ; s < num ; s ++ ) { long a [ ] = new long [ 3 ] ; for ( int i = 0 ; i < 3 ; i ++ ) { a [ i ] = scanner . nextLong ( ) ; } Arrays . sort ( a ) ; if ( a [ 2 ] >= a [ 0 ] + a [ 1 ] ) System . out . println ( a [ 0 ] + a [ 1 ] ) ; else { System . out . println ( ( a [ 0 ] - ( a [ 2 ] - a [ 1 ] ) ) / 2 + a [ 2 ] ) ; } } } }

for _ in range ( int ( input ( ) ) ) : l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) print ( min ( l [ 0 ] + l [ 1 ] , sum ( l ) // 2 ) ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) if l [ 0 ] + l [ 1 ] <= l [ 2 ] : print ( l [ 0 ] + l [ 1 ] ) else : print ( sum ( l ) // 2 )         NEW_LINE

t = int ( input ( ) ) ans = [ ] for _ in range ( t ) : arr = sorted ( map ( int , input ( ) . split ( ) ) ) if arr [ - 1 ] > arr [ 0 ] + arr [ 1 ] : ans . append ( arr [ 0 ] + arr [ 1 ] ) else : ans . append ( sum ( arr ) // 2 )   for a in ans : print ( a ) NEW_LINE

t = int ( input ( ) ) for _ in range ( t ) : l = list ( map ( int , input ( ) . split ( ) ) ) l . sort ( ) print ( min ( l [ 0 ] + l [ 1 ] , sum ( l ) // 2 ) ) NEW_LINE


import java . util . * ;   public class Solve {   static Scanner scan = new Scanner ( System . in ) ;   public static void solve ( int n , int [ ] a ) { int fingers = 0 ; for ( int i = 0 ; i < n ; i ++ ) { fingers += a [ i ] ; }   int count = 0 ; for ( int i = 1 ; i <= 5 ; i ++ ) { if ( ( fingers + i ) % ( n + 1 ) == 1 ) { count ++ ; } } System . out . println ( 5 - count ) ; }    public static void main ( String [ ] args ) {   int n = scan . nextInt ( ) ; int [ ] a = new int [ n ] ;   for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = scan . nextInt ( ) ; }   solve ( n , a ) ; } }

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

import java . util . Scanner ;   public class Problem_272A { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int friends = s . nextInt ( ) ; int fingerSum = 0 ; for ( int i = 0 ; i < friends ; i ++ ) fingerSum += s . nextInt ( ) ;   int ways = 0 ; for ( int i = 1 ; i <= 5 ; i ++ ) { if ( ( fingerSum + i ) % ( friends + 1 ) != 1 ) { ways ++ ; } }   System . out . println ( ways ) ;   } }

import java . util . Scanner ; public class Practice { public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ; int no_of_friends = sc . nextInt ( ) ; int other_fingers = 0 ; for ( int i = 0 ; i < no_of_friends ; i ++ ) { other_fingers += sc . nextInt ( ) ; } no_of_friends += 1 ; int ans = 1 ; for ( int i = 1 ; i <= 5 ; i ++ ) { int m = i + other_fingers ; if ( m % no_of_friends != 1 ) { ans += 1 ; } } System . out . println ( ans - 1 ) ; } }

n = int ( input ( ) ) A = list ( map ( int , input ( ) . split ( ) ) ) f = n + 1 cnt = 0 for i in range ( sum ( A ) + 1 , sum ( A ) + 6 ) : if i % f == 1 : cnt += 1 print ( 5 - cnt ) NEW_LINE

n = int ( input ( ) ) a = n + 1 x = list ( map ( int , input ( ) . split ( ) ) ) c1 = 1 c2 = 0 l1 = [ ] l2 = [ ] for i in x : c1 = c1 + ifor i in range ( c1 , c1 + 5 ) : l1 . append ( i ) for i in l1 : l2 . append ( i % a ) for i in l2 : if i == 1 : pass else : c2 = c2 + 1 print ( c2 ) NEW_LINE

n = int ( input ( ) ) + 1 fingers = sum ( map ( int , input ( ) . split ( ) ) ) start = fingers % noptions = 0 for x in range ( 1 , 6 ) : if ( start + x ) % n != 1 : options += 1 print ( options ) NEW_LINE

n = int ( input ( ) )   fingers = [ int ( i ) for i in input ( ) . split ( ' ▁ ' ) ] fingers = sum ( fingers ) res = 0 for i in range ( 1 , 6 ) : if ( fingers + i - 1 ) % ( n + 1 ) != 0 : res += 1   print ( res ) NEW_LINE


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { System . out . print ( "7" ) ; for ( int a = 0 ; a < ( arr [ i ] / 2 - 1 ) ; a ++ ) { System . out . print ( "1" ) ; } System . out . println ( ) ; } else { for ( int b = 0 ; b < ( arr [ i ] / 2 ) ; b ++ ) { System . out . print ( "1" ) ; } System . out . println ( ) ; } } } }

import com . sun . security . jgss . GSSUtil ; import org . w3c . dom . Node ;   import javax . print . DocFlavor ; import javax . swing . table . AbstractTableModel ; import java . io . * ; import java . util . * ; import java . util . concurrent . atomic . AtomicReferenceFieldUpdater ;

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) , k = 0 ; if ( n % 2 == 0 ) { n = n / 2 ; } else { n -= 3 ; k = 3 ; n = n / 2 ; } if ( n == 0 ) System . out . println ( "7" ) ; else { String str = String . format ( " % 0" + n + " d " , 0 ) . replace ( "0" , "1" ) ; if ( k != 0 ) str = "7" + str ; System . out . println ( str ) ; } } sc . close ( ) ; } }

import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; StringBuilder sb = new StringBuilder ( " " ) ; while ( n > 3 ) { sb . append ( "1" ) ; n -= 2 ; } String s = sb . toString ( ) ; if ( n == 3 ) s = '7' + s ; if ( n == 2 ) s = s + '1' ; System . out . println ( s ) ; } } }

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if ( n % 2 == 1 ) : print ( 7 , end = ' ' ) n -= 3 while ( n > 0 ) : print ( 1 , end = ' ' ) n -= 2 print ( ) NEW_LINE

for _ in range ( int ( input ( ) ) ) : n = int ( input ( ) ) if n % 2 == 0 : k = n // 2 print ( "1" * k ) else : k = ( n - 3 ) // 2 print ( "7" + "1" * k ) NEW_LINE

import sysfrom os import pathif ( path . exists ( ' input . txt ' ) and path . exists ( ' output . txt ' ) ) : sys . stdout = open ( ' output . txt ' , ' w ' ) sys . stdin = open ( ' input . txt ' , ' r ' )   NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : n = int ( input ( ) ) if n % 2 == 0 : print ( "1" * ( n // 2 ) ) else : print ( "7" , end = " " ) print ( "1" * ( ( n - 3 ) // 2 ) ) NEW_LINE


import java . util . Scanner ;   public class grasshopper { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int p = scan . nextInt ( ) , max = scan . nextInt ( ) ; for ( int i = max ; i > p ; i -- ) { boolean good = true ; int f = i ; for ( int j = 2 ; j * j <= i ; j ++ ) { if ( f % j == 0 && j <= p ) { good = false ; break ; } while ( f % j == 0 ) f /= j ; } if ( good && ( f == 1 || f > p ) ) { System . out . println ( i ) ; return ; } } System . out . println ( - 1 ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . Arrays ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . ArrayList ; import java . util . TreeSet ; import java . util . Collections ; public class Hello { static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } public static void main ( String [ ] args ) { FastReader in = new FastReader ( ) ;

import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . StringTokenizer ;   public class Main {   public static void main ( String [ ] args ) throws Exception {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; StringTokenizer st ;   st = new StringTokenizer ( br . readLine ( ) ) ; int p = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ;   boolean [ ] isPrime = new boolean [ 1000001 ] ; for ( int i = 0 ; i <= 1000000 ; i ++ ) { isPrime [ i ] = true ; } isPrime [ 0 ] = false ; isPrime [ 1 ] = false ; for ( int i = 2 ; i <= 1000000 ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = i + i ; j <= 1000000 ; j += i ) { isPrime [ j ] = false ; } } }   int answer = - 1 ; for ( int i = y ; i > p ; i -- ) { boolean flag = true ; for ( int j = 2 ; j <= Math . min ( 1000000 , p ) ; j ++ ) { if ( isPrime [ j ] && i % j == 0 ) { flag = false ; } } if ( flag ) { answer = i ; break ; } }   bw . write ( answer + " " ) ;   bw . flush ( ) ; bw . close ( ) ; br . close ( ) ; }   }

import sysimport mathimport bisectfrom sys import stdin , stdoutfrom math import gcd , floor , sqrt , log2 , ceilfrom collections import defaultdict as ddfrom bisect import bisect_left as bl , bisect_right as brfrom bisect import insortfrom collections import Counterfrom collections import dequefrom heapq import heappush , heappop , heapifyfrom itertools import permutations , combinationsmod = int ( 1e9 ) + 7   ip = lambda : int ( stdin . readline ( ) ) inp = lambda : map ( int , stdin . readline ( ) . split ( ) ) ips = lambda : stdin . readline ( ) . rstrip ( ) out = lambda x : stdout . write ( str ( x ) + " \n " )     import random def primeFactors ( n ) : arr = set ( ) while n % 2 == 0 : arr . add ( 2 ) n = n // 2 for i in range ( 3 , int ( math . sqrt ( n ) ) + 1 , 2 ) : while n % i == 0 : n = n // i arr . add ( i ) if n > 2 : arr . add ( n ) arr = list ( arr ) return arr t = 1 for _ in range ( t ) : p , y = inp ( ) if y == p : ans = - 1 else : for i in range ( y , p , - 1 ) : arr = primeFactors ( i ) flag = True for j in arr : if j >= 2 and j <= p : flag = False break if flag : break if flag : ans = i else : ans = - 1 out ( ans )                                                                                NEW_LINE

from sys import stdin   def firstDiv ( n ) : NEW_LINE

p , y = map ( int , input ( ) . split ( ) )   def div ( n ) : for i in range ( 2 , int ( n ** ( 1 / 2 ) ) + 1 ) : if n % i == 0 : return i return n   while y > p : if div ( y ) > p : print ( y ) break y -= 1   if y <= p : print ( - 1 ) NEW_LINE

def mlt ( ) : return map ( int , input ( ) . split ( ) )     x , y = mlt ( )     def mn ( x ) : n = 2 if x % 2 == 0 : return 2   n = 3 while n * n <= x : if x % n == 0 : return n n += 2   return x     while y > x : if mn ( y ) > x : print ( y ) exit ( 0 ) y -= 1   print ( - 1 ) NEW_LINE

import mathdef printDivisors ( n ) : i = 2 s = set ( ) while i <= math . sqrt ( n ) : if ( n % i == 0 ) : if ( n // i == i ) : s . add ( i )   else : s . add ( i ) s . add ( n // i )   i = i + 1   return s   p , y = map ( int , input ( ) . split ( ) ) m = - 1j = ywhile ( j > p ) : e = printDivisors ( j ) f = 0 for i in e : if i <= p : f = 1 break   if f == 0 : m = j break   j = j - 1   print ( m ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { Scanner infile = new Scanner ( System . in ) ; int T = infile . nextInt ( ) ; while ( T -- > 0 ) { int N = infile . nextInt ( ) ; int [ ] freq = new int [ N + 1 ] ; while ( N -- > 0 ) { freq [ infile . nextInt ( ) ] ++ ; } int res = 0 ; for ( int x : freq ) res = Math . max ( res , x ) ; System . out . println ( res ) ; } } }

import java . util . Scanner ;   public class NezzarandColorfulBalls { public static void main ( String args [ ] ) { Scanner scan = new Scanner ( System . in ) ; int t = scan . nextInt ( ) ; while ( t -- > 0 ) { int n = scan . nextInt ( ) ; int [ ] a = new int [ 1010 ] ; for ( int i = 0 ; i < n ; i ++ ) { ++ a [ scan . nextInt ( ) ] ; } int mx = 0 ; for ( int i = 0 ; i < 1010 ; i ++ ) { mx = Math . max ( a [ i ] , mx ) ; } System . out . println ( mx ) ; } } }

import java . util . * ;   public final class Test {   public static void main ( String args [ ] ) { int t ; Scanner sc = new Scanner ( System . in ) ; t = sc . nextInt ( ) ; while ( t -- > 0 ) { int n = sc . nextInt ( ) ; int a [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } System . out . println ( getMinColor ( a ) ) ; } sc . close ( ) ; }   static int getMinColor ( int [ ] numbers ) { int maxDuplicateCount = 0 ; int curDuplicate = 0 ; for ( int i = 0 ; i < numbers . length - 1 ; i ++ ) { curDuplicate = 0 ; while ( i < numbers . length - 1 && numbers [ i ] == numbers [ i + 1 ] ) { curDuplicate ++ ; i ++ ; } if ( curDuplicate > maxDuplicateCount ) { maxDuplicateCount = curDuplicate ; } } return maxDuplicateCount + 1 ; } }

import java . util . * ;   public class Runner { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int tests = sc . nextInt ( ) ; for ( int t = 0 ; t < tests ; t ++ ) { int numOfBalls = sc . nextInt ( ) ; sc . nextLine ( ) ; int [ ] balls = stringToIntArray ( sc . nextLine ( ) ) ; int lowestIndex = 0 ; int total = 0 ; for ( int i = 0 ; i < numOfBalls ; i ++ ) { int ithBall = balls [ i ] ; if ( ithBall == - 1 ) continue ; int cur = ithBall ; for ( int j = i + 1 ; j < numOfBalls ; j ++ ) { if ( balls [ i ] == - 1 ) continue ; if ( balls [ j ] > cur ) { cur = balls [ j ] ; balls [ j ] = - 1 ; } } total ++ ; balls [ i ] = - 1 ; } System . out . println ( total ) ; } }   private static int [ ] stringToIntArray ( String str ) { String [ ] strs = str . trim ( ) . split ( " ▁ " ) ; int [ ] intArr = new int [ strs . length ] ; for ( int i = 0 ; i < strs . length ; i ++ ) { intArr [ i ] = Integer . parseInt ( strs [ i ] ) ; } return intArr ; }   }

t = int ( input ( ) ) NEW_LINE while t : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE count = 1 NEW_LINE b = [ ] NEW_LINE flag = 0 NEW_LINE for i in range ( len ( a ) - 1 ) : if NEW_LINE a [ i ] == a [ i + 1 ] : count += 1 else : flag = 1 NEW_LINE b . append ( count ) NEW_LINE count = 1 NEW_LINE b . append ( count ) NEW_LINE if b != [ ] : NEW_LINE INDENT print ( max ( b ) ) else : NEW_LINE print ( len ( a ) ) NEW_LINE DEDENT t -= 1     NEW_LINE

for t in range ( int ( input ( ) ) ) : n = int ( input ( ) ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE a = sorted ( a , reverse = True , key = a . count ) NEW_LINE print ( a . count ( a [ 0 ] ) ) NEW_LINE

for i in range ( int ( input ( ) ) ) : input ( ) NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE print ( max ( [ a . count ( i ) for i in a ] ) ) NEW_LINE

import matht = int ( input ( ) ) NEW_LINE for i in range ( 0 , t ) : n = int ( input ( ) ) NEW_LINE l = list ( map ( int , input ( ) . split ( ) ) ) NEW_LINE


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . InputMismatchException ; import java . io . IOException ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskB solver = new TaskB ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class TaskB { String str ; int n ; int m ; int [ ] [ ] ar ;   public void solve ( int testNumber , InputReader in , PrintWriter out ) { int x , y ; n = in . nextInt ( ) ; m = in . nextInt ( ) ; x = in . nextInt ( ) - 1 ; y = in . nextInt ( ) - 1 ; ar = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { ar [ i ] [ j ] = Integer . MAX_VALUE ; } } str = in . readString ( ) ;

x , y , x0 , y0 = list ( map ( int , input ( ) . split ( ) ) ) s = input ( ) x0 -= 1 y0 -= 1 k = [ 1 ] summa = 1 a = [ [ 0 ] * ( y ) for i in range ( x ) ] a [ x0 ] [ y0 ] = 1 for i in s : if i == " U " : x0 = max ( x0 - 1 , 0 ) elif i == " D " : x0 = min ( x0 + 1 , x - 1 ) elif i == " R " : y0 = min ( y0 + 1 , y - 1 ) else : y0 = max ( y0 - 1 , 0 ) if a [ x0 ] [ y0 ] : k . append ( 0 ) else : a [ x0 ] [ y0 ] = 1 k . append ( 1 ) summa += 1 k [ - 1 ] += x * y - summaprint ( ' ▁ ' . join ( str ( i ) for i in k ) ) NEW_LINE

X , Y , x , y = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   dir = { ' U ' : ( - 1 , 0 ) , ' D ' : ( 1 , 0 ) , ' L ' : ( 0 , - 1 ) , ' R ' : ( 0 , 1 ) } field = [ [ 1 ] * Y for i in range ( X ) ]   x -= 1 y -= 1 for c in s : print ( field [ x ] [ y ] ) field [ x ] [ y ] = 0 x += dir [ c ] [ 0 ] y += dir [ c ] [ 1 ] if x < 0 : x = 0 if x >= X : x = X - 1 if y < 0 : y = 0 if y >= Y : y = Y - 1   print ( sum ( sum ( field [ i ] ) for i in range ( X ) ) )   NEW_LINE

x , y , x0 , y0 = map ( int , input ( ) . split ( ) ) s = input ( )   isVisited = [ ] for i in range ( x ) : isVisited . append ( [ ] ) for j in range ( y ) : isVisited [ i ] . append ( False ) cnt = 1 ans = [ "1" ] isVisited [ x0 - 1 ] [ y0 - 1 ] = Truelocx = x0 - 1 locy = y0 - 1 for elem in s : if elem == " U " : locx -= 1 if locx < 0 : locx = 0 if elem == " R " : locy += 1 if locy >= y : locy = y - 1 if elem == " D " : locx += 1 if locx >= x : locx = x - 1 if elem == " L " : locy -= 1 if locy < 0 : locy = 0 if not isVisited [ locx ] [ locy ] : isVisited [ locx ] [ locy ] = True ans . append ( "1" ) cnt += 1 else : ans . append ( "0" ) ans [ - 1 ] = int ( ans [ - 1 ] ) ans [ - 1 ] += x * y - cntans [ - 1 ] = str ( ans [ - 1 ] ) print ( " ▁ " . join ( ans ) ) NEW_LINE


import java . util . Arrays ; import java . util . Comparator ; import java . util . Scanner ;   public class n456A { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] [ ] result = new int [ n ] [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { result [ i ] [ 0 ] = scanner . nextInt ( ) ; result [ i ] [ 1 ] = scanner . nextInt ( ) ; } Arrays . sort ( result , new Comparator < int [ ] > ( ) { @ Override public int compare ( int [ ] o1 , int [ ] o2 ) { if ( o1 [ 0 ] < o2 [ 0 ] ) return - 1 ; else if ( o1 [ 0 ] > o2 [ 0 ] ) return 1 ; else { if ( o1 [ 1 ] < o2 [ 1 ] ) return - 1 ; else if ( o1 [ 1 ] > o2 [ 1 ] ) return 1 ; return 0 ; } } } ) ;   int last = result [ 0 ] [ 1 ] ; if ( n == 1 ) { System . out . println ( " Poor ▁ Alex " ) ; } else { for ( int i = 1 ; i < n ; i ++ ) { if ( result [ i ] [ 1 ] < last ) { System . out . println ( " Happy ▁ Alex " ) ; break ; } last = result [ i ] [ 1 ] ; if ( i == n - 1 ) System . out . println ( " Poor ▁ Alex " ) ; } } } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . StringTokenizer ;   public class Laptops { static FastReader sc = new FastReader ( ) ;   static void input ( int a [ ] ) { for ( int i = 0 ; i < a . length ; i ++ ) { a [ i ] = sc . nextInt ( ) ; } }   static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   static class pair { int a , b ;   pair ( int a , int b ) { this . a = a ; this . b = b ; } }   public static void main ( String [ ] args ) {   int n = sc . nextInt ( ) ; ArrayList < pair > a = new ArrayList < pair > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int az = sc . nextInt ( ) , bz = sc . nextInt ( ) ; pair p = new pair ( az , bz ) ; a . add ( p ) ;   }

import java . util . * ; public class Laptops {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; boolean found = false ;   ArrayList < LapData > list = new ArrayList < > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int price = sc . nextInt ( ) ; int quality = sc . nextInt ( ) ;   LapData l = new LapData ( price , quality ) ; list . add ( l ) ;   } sc . close ( ) ;   Collections . sort ( list , new Comparator < LapData > ( ) { public int compare ( LapData l1 , LapData l2 ) { return l1 . quality - l2 . quality ; } } ) ;   int cp = list . get ( 0 ) . price ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) {   if ( list . get ( i ) . price < cp ) { found = true ; break ; } else { cp = list . get ( i ) . price ; } }   if ( found ) { System . out . println ( " Happy ▁ Alex " ) ; } else System . out . println ( " Poor ▁ Alex " ) ;   } }   class LapData { int price ; int quality ;   public LapData ( int price , int quality ) { this . price = price ; this . quality = quality ; } }

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

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

import sys , functools , collections , bisect , math , heapqinput = sys . stdin . readline NEW_LINE

n = int ( input ( ) ) Test = Falsefor i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) if a < b : Test = True           if Test : print ( " Happy ▁ Alex " ) else : print ( " Poor ▁ Alex " ) NEW_LINE

n = int ( input ( ) ) a = ' Poor ▁ Alex ' for i in range ( n ) : b , c = map ( int , input ( ) . split ( ) ) if b < c : a = ' Happy ▁ Alex ' print ( a ) NEW_LINE

n = int ( input ( ) ) a = [ ] for i in range ( n ) : p , q = map ( int , input ( ) . split ( ) ) a . append ( [ p , q ] ) a . sort ( key = lambda x : x [ 0 ] ) f = 0 for i in range ( n - 1 ) : if a [ i ] [ 1 ] > a [ i + 1 ] [ 1 ] : f = 1 breakif f : print ( " Happy ▁ Alex " ) else : print ( " Poor ▁ Alex " ) NEW_LINE


import java . io . * ; import java . util . * ; public class Main2 { static BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; static StringTokenizer st ; static String ns ( ) { while ( st == null || ( ! st . hasMoreTokens ( ) ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) {

import sysinput = sys . stdin . readline   def main ( ) : n , m = map ( int , input ( ) . split ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) + [ 0 ] * 500000 ans_S = 0 a [ n ] = a [ 0 ] + m s = [ 0 ] * 600600 for i in range ( n ) : s [ i ] = a [ i + 1 ] - a [ i ] s [ n ] = - 1 for i in range ( n ) : s [ 2 * n - i ] = s [ i ] for i in range ( 2 * n + 1 , 3 * n + 1 ) : s [ i ] = s [ i - n ] l , r = 0 , 0 z = [ 0 ] * 600600 for i in range ( 1 , 3 * n + 1 ) : if i < r : z [ i ] = z [ i - l ] while i + z [ i ] <= 3 * n and ( s [ i + z [ i ] ] == s [ z [ i ] ] ) : z [ i ] += 1 if i + z [ i ] > r : l = i r = i + z [ i ] ans = [ ] for i in range ( n + 1 , 2 * n + 1 ) : if z [ i ] < n : continue ans_S += 1 ans . append ( ( a [ 0 ] + a [ 2 * n - i + 1 ] ) % m ) ans . sort ( ) print ( ans_S ) print ( * ans ) return   if __name__ == " _ _ main _ _ " : main ( ) NEW_LINE


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

import java . util . * ; import java . util . stream . * ;   public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; scan . nextLine ( ) ; Set < Integer > middle = new HashSet < Integer > ( ) ; Set < Integer > bottom = new HashSet < Integer > ( ) ; String result = " YES " ; for ( int i = 0 ; i < n ; i ++ ) { StringBuilder s = new StringBuilder ( scan . nextLine ( ) ) ; for ( Integer elem : bottom ) { if ( s . charAt ( elem ) == ' . ' ) { s . setCharAt ( elem , ' # ' ) ; } else { result = " NO " ; break ; } } bottom . clear ( ) ;

import java . util . * ;   public class Absolutezero {    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < String > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { list . add ( sc . next ( ) ) ; } int dots = 0 ; int mo = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { char ch = list . get ( i ) . charAt ( j ) ; if ( ch == ' . ' ) { dots ++ ; } } } for ( int i = 1 ; i < n - 1 ; i ++ ) { for ( int j = 1 ; j < n - 1 ; j ++ ) { String s1 = list . get ( i ) ; String s2 = list . get ( i - 1 ) ; String s3 = list . get ( i + 1 ) ; char ch = list . get ( i ) . charAt ( j ) ; char ch1 = list . get ( i ) . charAt ( j + 1 ) ; char ch2 = list . get ( i ) . charAt ( j - 1 ) ; char ch3 = list . get ( i - 1 ) . charAt ( j ) ; char ch4 = list . get ( i + 1 ) . charAt ( j ) ;   if ( ch == ' . ' && ch1 == ' . ' && ch2 == ' . ' && ch3 == ' . ' && ch4 == ' . ' ) { String s11 = s1 . substring ( 0 , j - 1 ) + " # # # " + s1 . substring ( j + 2 ) ; list . set ( i , s11 ) ; String s12 = s2 . substring ( 0 , j ) + " # " + s2 . substring ( j + 1 ) ; list . set ( i - 1 , s12 ) ; String s13 = s3 . substring ( 0 , j ) + " # " + s3 . substring ( j + 1 ) ; list . set ( i + 1 , s13 ) ;

import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . PrintStream ; import java . io . PrintWriter ; import java . security . AccessControlException ; import java . util . Arrays ; import java . util . Collection ; import java . util . List ; import java . util . Objects ; import java . util . Scanner ; import java . util . function . Function ; import java . util . stream . Collectors ; import java . util . stream . IntStream ; import java . util . stream . LongStream ; import java . util . stream . Stream ; public class _p001150B { static public void main ( final String [ ] args ) throws IOException { p001150B . _main ( args ) ; }

import java . util . * ; public class tilingChallange { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] [ ] a = new int [ n ] [ n ] ; sc . nextLine ( ) ; for ( int i = 0 ; i < n ; i ++ ) { String s = sc . nextLine ( ) . trim ( ) ; for ( int j = 0 ; j < n ; j ++ ) { if ( s . charAt ( j ) == ' # ' ) a [ i ] [ j ] = 1 ; else a [ i ] [ j ] = 0 ; } } for ( int i = 1 ; i < n - 1 ; i ++ ) { for ( int j = 1 ; j < n - 1 ; j ++ ) { if ( a [ i ] [ j ] == 0 ) { if ( a [ i - 1 ] [ j ] == 0 && a [ i + 1 ] [ j ] == 0 && a [ i ] [ j + 1 ] == 0 && a [ i ] [ j - 1 ] == 0 ) { a [ i - 1 ] [ j ] = a [ i + 1 ] [ j ] = a [ i ] [ j - 1 ] = a [ i ] [ j + 1 ] = a [ i ] [ j ] = 1 ; } } } } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) { if ( a [ i ] [ j ] == 0 ) { System . out . println ( " NO " ) ; return ; } } System . out . println ( " YES " ) ; } }

n = int ( input ( ) )   arr = [ list ( input ( ) ) for _ in range ( n ) ]   for i in range ( n ) : for j in range ( n ) : if i == 0 or i == n - 1 or j == 0 or j == n - 1 : continue if arr [ i ] [ j ] == ' # ' : continue   if arr [ i - 1 ] [ j ] == ' # ' or arr [ i + 1 ] [ j ] == ' # ' or arr [ i ] [ j - 1 ] == ' # ' or arr [ i ] [ j + 1 ] == ' # ' : continue   arr [ i ] [ j ] = ' # ' arr [ i ] [ j + 1 ] = ' # ' arr [ i ] [ j - 1 ] = ' # ' arr [ i + 1 ] [ j ] = ' # ' arr [ i - 1 ] [ j ] = ' # ' f = Truefor i in arr : if ' . ' in i : f = False break     print ( " YES " if f else " NO " ) NEW_LINE

if __name__ == " _ _ main _ _ " : n = int ( input ( ) ) matrix = [ ] supposed_to_be_total = ( n * n ) while n : s = input ( ) matrix . append ( list ( s ) ) n = n - 1 m = len ( matrix ) i = 1 while i < m - 1 : j = 1 while j < m - 1 : if matrix [ i ] [ j ] == ' # ' : count = 0 j = j + 1 continue else : if ( matrix [ i + 1 ] [ j ] == ' . ' ) and ( matrix [ i - 1 ] [ j ] == ' . ' ) and ( matrix [ i ] [ j - 1 ] == ' . ' ) and ( matrix [ i ] [ j + 1 ] == ' . ' ) : matrix [ i + 1 ] [ j ] = ' # ' matrix [ i - 1 ] [ j ] = ' # ' matrix [ i ] [ j - 1 ] = ' # ' matrix [ i ] [ j + 1 ] = ' # ' matrix [ i ] [ j ] = ' # ' j = j + 1 i = i + 1 for i in range ( m ) : if ' . ' in matrix [ i ] : print ( " NO " ) exit ( 0 ) print ( " YES " ) NEW_LINE


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

n = int ( input ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] ans = [ n for i in range ( n ) ]   for num in range ( n ) : lol = 0 c = 0 for i in range ( len ( a ) ) : if ( a [ i ] . count ( num ) > c ) : lol = i c = a [ i ] . count ( num ) ans [ lol ] = numprint ( * ans )                           NEW_LINE

n = int ( input ( ) ) permutation = [ ] for _ in range ( n ) : S = set ( input ( ) . split ( ) ) permutation . append ( len ( S ) - 1 ) for i in range ( n ) : if permutation [ i ] == n - 1 : permutation [ i ] += 1 breakprint ( * permutation ) NEW_LINE

n = int ( input ( ) ) permutation = [ ] for _ in range ( n ) : S = set ( input ( ) . split ( ) ) permutation . append ( len ( S ) - 1 ) permutation [ permutation . index ( n - 1 ) ] = nprint ( * permutation ) NEW_LINE

n = int ( input ( ) ) a = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] chosen = set ( ) p = [ 0 ] * nfor i in range ( 1 , n + 1 ) : b = - 1 for j in range ( n ) : if not j in chosen and all ( a [ j ] [ k ] <= i for k in range ( n ) ) and all ( a [ k ] [ j ] <= i for k in range ( n ) ) : b = j p [ b ] = i chosen . add ( b ) print ( * p ) NEW_LINE

import sysarr = [ ] n = int ( input ( ) ) for x in range ( n ) : arr . append ( max ( list ( map ( int , input ( ) . split ( ) ) ) ) ) arr [ arr . index ( n - 1 ) ] = nprint ( * arr ) NEW_LINE


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

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ; import java . io . PrintWriter ;      public class A {     public static void main ( String [ ] args ) throws IOException { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int t = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; double x1 = sc . nextDouble ( ) ; double y1 = sc . nextDouble ( ) ; double len = 0 ; while ( t -- > 1 ) { double x2 = sc . nextDouble ( ) ; double y2 = sc . nextDouble ( ) ; len += Math . sqrt ( Math . pow ( x2 - x1 , 2 ) + Math . pow ( y2 - y1 , 2 ) ) ; x1 = x2 ; y1 = y2 ; } out . println ( ( len / 50 ) * k ) ; out . close ( ) ; }

import java . util . * ; import java . util . stream . * ; public class Solution { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int k = scan . nextInt ( ) ; double s = 0 ; int tx = 0 ; int ty = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int x = scan . nextInt ( ) ; int y = scan . nextInt ( ) ; if ( i > 0 ) { s += Math . sqrt ( ( ( x - tx ) * ( x - tx ) ) + ( ( y - ty ) * ( y - ty ) ) ) ; } tx = x ; ty = y ; } double result = ( k * s ) / 50 ; System . out . println ( result ) ; } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; double ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int c = in . nextInt ( ) ; int d = in . nextInt ( ) ; ans += Math . abs ( Math . sqrt ( ( a - c ) * ( a - c ) + ( b - d ) * ( b - d ) ) ) ; a = c ; b = d ; } System . out . println ( ( ans * k / 50 ) ) ; in . close ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class WastedTime { public static void main ( String [ ] args ) { FastReader fs = new FastReader ( ) ; StringBuilder sb = new StringBuilder ( ) ; int t = fs . nextInt ( ) ; int k = fs . nextInt ( ) ; int prevX = 0 ; int prevY = 0 ; int currX = 0 ; int currY = 0 ; double sum = 0 ; for ( int tt = 0 ; tt < t ; tt ++ ) { if ( tt == 0 ) { prevX = fs . nextInt ( ) ; prevY = fs . nextInt ( ) ; } else { currX = fs . nextInt ( ) ; currY = fs . nextInt ( ) ; sum += dist ( currX , prevX , currY , prevY ) ; prevX = currX ; prevY = currY ; } } System . out . println ( k * sum / 50.0 ) ; }   public static double dist ( int x1 , int x2 , int y1 , int y2 ) { return Math . sqrt ( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ) ; }   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 ( ) ) ; }   float nextFloat ( ) { return Float . parseFloat ( next ( ) ) ; } } }

n , k = map ( int , input ( ) . split ( ) ) px , py = map ( int , input ( ) . split ( ) ) ans = 0 for i in range ( n - 1 ) : x , y = map ( int , input ( ) . split ( ) ) ans += ( ( ( px - x ) ** 2 + ( py - y ) ** 2 ) ** .5 ) px , py = x , yprint ( ans * ( k / 50 ) ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) a , b = map ( int , input ( ) . split ( ) ) l = 0   for _ in range ( 1 , n ) : x , y = map ( int , input ( ) . split ( ) ) l += ( ( x - a ) ** 2 + ( y - b ) ** 2 ) ** 0.5 a , b = x , y   print ( l * k / 50 ) NEW_LINE

n , k = map ( int , input ( ) . split ( ) ) distance = 0 x , y = map ( int , input ( ) . split ( ) ) for i in range ( n - 1 ) : a , b = map ( int , input ( ) . split ( ) ) distance += ( ( x - a ) ** 2 + ( y - b ) ** 2 ) ** 0.5 x , y = a , btotal = k * distanceprint ( ' % .9f ' % ( total / 50 ) ) NEW_LINE

import math as mtn , k = map ( int , input ( ) . split ( ) ) arr = [ list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) ] dist = 0 for i in range ( 1 , n ) : dist += ( mt . sqrt ( ( arr [ i ] [ 1 ] - arr [ i - 1 ] [ 1 ] ) ** 2 + ( arr [ i ] [ 0 ] - arr [ i - 1 ] [ 0 ] ) ** 2 ) ) print ( " { : . 9f } " . format ( dist * k / 50 ) ) NEW_LINE

import sysinput = sys . stdin . readlineimport math   def inpit ( ) : NEW_LINE


import java . util . * ; public class asd { static Scanner s = new Scanner ( System . in ) ; public static void main ( String args [ ] ) { int t = 1 ; while ( t -- > 0 ) { solve ( ) ; } } public static void solve ( ) { int n = s . nextInt ( ) - 1 ; ArrayList < Integer > list = new ArrayList < > ( ) ;   int p = s . nextInt ( ) ; int q = s . nextInt ( ) ; for ( int i = p ; i < q ; i ++ ) { list . add ( i ) ; } while ( n -- > 0 ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; for ( int i = a ; i < b ; i ++ ) { if ( list . contains ( i ) ) list . remove ( new Integer ( i ) ) ; } } System . out . println ( list . size ( ) ) ;   } }

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

import java . util . HashSet ; import java . util . Scanner ; import java . util . Set ; import java . util . ArrayList ; import java . util . Collections ; import java . lang . Math ; public class Lo { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] A = new int [ 101 ] ; int l1 = sc . nextInt ( ) ; int r1 = sc . nextInt ( ) ; for ( int i = l1 ; i < r1 ; i ++ ) { A [ i ] = 1 ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { int x = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; for ( int j = x ; j < y ; j ++ ) { A [ j ] = 2 ; } } int count = 0 ; for ( int i = 0 ; i <= 100 ; i ++ ) { if ( A [ i ] == 1 ) { count ++ ; } } System . out . println ( count ) ; } }

import java . util . Scanner ;   public class A_OnSegmentsOwnPoints {   public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int [ ] times = new int [ 101 ] ; int start = scan . nextInt ( ) ; int end = scan . nextInt ( ) ; for ( int i = start ; i < end ; i ++ ) { times [ i ] = 1 ; } for ( int j = 0 ; j < n - 1 ; j ++ ) { int oStart = scan . nextInt ( ) ; int oEnd = scan . nextInt ( ) ; for ( int k = oStart ; k < oEnd ; k ++ ) { times [ k ] = 0 ; } } int totalTime = 0 ; for ( int l = 0 ; l < times . length ; l ++ ) { totalTime += times [ l ] ; } System . out . println ( totalTime ) ;   scan . close ( ) ; }   }

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

n = int ( input ( ) ) l = [ ] q = [ 0 ] * 100 p = list ( map ( int , input ( ) . split ( ) ) ) l . append ( p ) for i in range ( n - 1 ) : p = list ( map ( int , input ( ) . split ( ) ) ) l . append ( p ) for k in range ( p [ 0 ] , p [ 1 ] ) : q [ k ] = 1 r = 0 for i in range ( l [ 0 ] [ 0 ] , l [ 0 ] [ 1 ] ) : if ( q [ i ] == 0 ) : r = r + 1 print ( r ) NEW_LINE

n = int ( input ( ) ) a , b = input ( ) . split ( ) a , b = int ( a ) , int ( b ) z = [ 0 ] * 101 for i in range ( n - 1 ) : S , E = input ( ) . split ( ) for i in range ( int ( S ) + 1 , int ( E ) + 1 ) : z [ i ] = 1 NEW_LINE

n = int ( input ( ) ) f = 1 start = [ ] end = [ ] main = [ ] res = [ ] for i in range ( n ) : num = list ( map ( int , input ( ) . split ( ) ) ) main . append ( num [ 0 ] ) main . append ( num [ 1 ] ) if f == 1 : f = 0 als = num [ 0 ] ale = num [ 1 ] continue start . append ( num [ 0 ] ) end . append ( num [ 1 ] ) m = max ( main ) NEW_LINE

n = int ( input ( ) ) ans = [ 1 ] * 100   a , b = map ( int , input ( ) . split ( ) )   for k in range ( n - 1 ) : l , r = map ( int , input ( ) . split ( ) ) for i in range ( l , r ) : ans [ i ] = 0   print ( sum ( ans [ a : b ] ) ) NEW_LINE

n = int ( input ( ) ) Al , Ar = map ( int , input ( ) . split ( ) ) cnt = [ 0 ] * 101 for i in range ( n - 1 ) : l , r = map ( int , input ( ) . split ( ) ) for j in range ( l , r ) : cnt [ j ] = 1 ans = 0 for i in range ( Al , Ar ) : if cnt [ i ] == 0 : ans += 1 print ( ans ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class TshirtHunt { public static boolean winTshirt ( int s , int p ) { int a = ( s / 50 ) % 475 ;   for ( int i = 0 ; i < 25 ; i ++ ) { a = ( a * 96 + 42 ) % 475 ; if ( p == 26 + a ) return true ; } return false ; }   public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;   StringTokenizer st = new StringTokenizer ( br . readLine ( ) ) ; int p = Integer . parseInt ( st . nextToken ( ) ) ; int x = Integer . parseInt ( st . nextToken ( ) ) ; int y = Integer . parseInt ( st . nextToken ( ) ) ;   for ( int i = x ; i >= y ; i -= 50 ) { if ( winTshirt ( i , p ) ) { System . out . println ( 0 ) ; return ; } }   int counter = 0 ; while ( true ) { counter ++ ; x += 100 ;   if ( x < y ) continue ;   if ( winTshirt ( x , p ) ) { break ; }   if ( x - 50 >= y && winTshirt ( x - 50 , p ) ) { break ; } }   System . out . println ( counter ) ; } }

import java . math . BigInteger ; import java . sql . Array ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . InputMismatchException ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import java . util . PriorityQueue ; import java . util . Queue ; import java . util . Scanner ; import java . util . Set ; import java . util . Stack ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . Scanner ; import java . util . StringTokenizer ; import java . util . TreeMap ; import java . util . TreeSet ; public class Main { static InputReader rd = new InputReader ( System . in ) ; public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int p , x , y ; p = sc . nextInt ( ) ; x = sc . nextInt ( ) ; y = sc . nextInt ( ) ;   int i = ( x / 50 ) % 475 ; int k = - 1 ; for ( int j = x ; j >= y ; j -- ) { if ( isPresent ( j , p ) && ( x - j ) % 50 == 0 ) { k = j ; break ; } }

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

import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {   public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int p = input . nextInt ( ) ; int x = input . nextInt ( ) ; int y = input . nextInt ( ) ;   for ( int s = y ; s <= 1000000 ; s ++ ) { if ( ( s % 50 ) != ( x % 50 ) ) { continue ; } int i = ( s / 50 ) % 475 ;   for ( int j = 0 ; j < 25 ; j ++ ) {   i = ( i * 96 + 42 ) % 475 ; if ( i + 26 == p ) { System . out . println ( ( Math . max ( 0 , s - x ) + 50 ) / 100 ) ; return ; } } }   }   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 ( ) ; } }   }

p , x , y = map ( int , input ( ) . split ( ) )     def check ( s ) : i = ( s // 50 ) % 475 for t in range ( 25 ) : i = ( i * 96 + 42 ) % 475 if 26 + i == p : return True return False     flag = Falsefor up in range ( 500 ) : for down in range ( 500 ) : if x + 100 * up - 50 * down >= y and check ( x + 100 * up - 50 * down ) : print ( up ) flag = True break if flag : break NEW_LINE

p , x , y = map ( int , input ( ) . split ( ) )   def check ( s ) : i = ( s // 50 ) % 475 for t in range ( 25 ) : i = ( i * 96 + 42 ) % 475 if 26 + i == p : return True return False   for up in range ( 500 ) : for down in range ( 500 ) : if x + 100 * up - 50 * down >= y and check ( x + 100 * up - 50 * down ) : print ( up ) exit ( )   assert ( False ) NEW_LINE

import mathp , x , y = map ( int , input ( ) . split ( ) ) s = ywhile 1 : if abs ( x - s ) % 50 == 0 : break s -= - 1 while 1 : i = ( s // 50 ) % 475 for j in range ( 25 ) : i = ( i * 96 + 42 ) % 475 if i + 26 == p : break if i + 26 == p : break s += 50 if s <= x : print ( 0 ) else : if ( s - x ) % 100 == 0 : print ( ( s - x ) // 100 ) else : print ( ( s - x ) // 100 + 1 ) NEW_LINE


import java . util . * ; import java . io . * ; import java . lang . * ; public class Main { public static void main ( String [ ] args ) { FastScanner sc = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int n = sc . nextInt ( ) ; List < Pair > arr = new ArrayList < > ( ) ; int maxP = - 1 , maxT = - 1 , maxG = - 1 ; while ( n -- > 0 ) { int k = sc . nextInt ( ) ; String name = sc . next ( ) ; int t = 0 , g = 0 , p = 0 ; for ( int i = 0 ; i < k ; i ++ ) { String phone = sc . next ( ) ; int temp [ ] = new int [ 6 ] ; int l = 0 ; for ( int j = 0 ; j < 8 ; j ++ ) { if ( phone . charAt ( j ) == ' - ' ) continue ; temp [ l ] = phone . charAt ( j ) - '0' ; l ++ ; } boolean allSame = true , Sorted = true ;

import java . io . * ; import java . util . * ;   public class PhoneProblems_107B { public static void main ( String [ ] args ) throws IOException { FastReader fr = new FastReader ( ) ; PrintWriter pr = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = fr . nextInt ( ) ;   TreeMap < Integer , List < String > > taxi = new TreeMap < > ( ) ; TreeMap < Integer , List < String > > pizza = new TreeMap < > ( ) ; TreeMap < Integer , List < String > > girl = new TreeMap < > ( ) ;   while ( t -- > 0 ) { int n = fr . nextInt ( ) ; String s = fr . next ( ) ;   int [ ] count = new int [ 3 ] ;   for ( int i = 0 ; i < n ; i ++ ) { String str = fr . nextLine ( ) ; count [ validate ( str ) ] ++ ; }

n = int ( input ( ) ) taxi = { } pizza = { } girls = { } for l in range ( n ) : m , name = input ( ) . split ( ) taxi [ name ] = 0 pizza [ name ] = 0 girls [ name ] = 0 for o in range ( int ( m ) ) : x = input ( ) x = x . replace ( " - " , " " ) c = 0 v = x [ 0 ] for i in range ( 0 , 6 ) : if x [ i ] != v : c = 1 if c == 0 : taxi [ name ] += 1 continue c = 0 for i in range ( 1 , 6 ) : if x [ i ] >= x [ i - 1 ] : c = 1 if c == 0 : pizza [ name ] += 1 continue girls [ name ] += 1 c = 0 for i in taxi : if taxi [ i ] > c : c = taxi [ i ] x = [ ] print ( " If ▁ you ▁ want ▁ to ▁ call ▁ a ▁ taxi , ▁ you ▁ should ▁ call : " , end = " ▁ " ) for i in taxi : if c == taxi [ i ] : x . append ( i ) s = " , ▁ " . join ( x ) print ( s + " . " ) c = 0 for i in pizza : if pizza [ i ] > c : c = pizza [ i ] x = [ ] print ( " If ▁ you ▁ want ▁ to ▁ order ▁ a ▁ pizza , ▁ you ▁ should ▁ call : " , end = " ▁ " ) for i in pizza : if c == pizza [ i ] : x . append ( i ) s = " , ▁ " . join ( x ) print ( s + " . " ) c = 0 for i in girls : if girls [ i ] > c : c = girls [ i ] x = [ ] print ( " If ▁ you ▁ want ▁ to ▁ go ▁ to ▁ a ▁ cafe ▁ with ▁ a ▁ wonderful ▁ girl , ▁ you ▁ should ▁ call : " , end = " ▁ " ) for i in girls : if c == girls [ i ] : x . append ( i ) s = " , ▁ " . join ( x ) print ( s + " . " ) NEW_LINE

names = { } n = int ( input ( ) )   for book in range ( n ) : s , name = map ( str , input ( ) . split ( ) ) taxi = pizza = cafe = 0 for i in range ( int ( s ) ) : number = input ( ) . replace ( ' - ' , ' ' ) if number == number [ 0 ] * 6 : taxi += 1 elif len ( set ( number ) ) == 6 : for j in range ( 1 , len ( number ) ) : if int ( number [ j ] ) >= int ( number [ j - 1 ] ) : cafe += 1 break else : pizza += 1 else : cafe += 1 names [ name ] = { " taxi " : taxi , " pizza " : pizza , " cafe " : cafe }   taxi_guys , pizza_guys , cafe_guys = [ ] , [ ] , [ ] max_taxi = max_pizza = max_cafe = 0   for name in names : max_taxi = max ( names [ name ] [ " taxi " ] , max_taxi ) max_pizza = max ( names [ name ] [ " pizza " ] , max_pizza ) max_cafe = max ( names [ name ] [ " cafe " ] , max_cafe )   for name in names : if names [ name ] [ " taxi " ] == max_taxi : taxi_guys . append ( name ) if names [ name ] [ " pizza " ] == max_pizza : pizza_guys . append ( name ) if names [ name ] [ " cafe " ] == max_cafe : cafe_guys . append ( name )   print ( f " If ▁ you ▁ want ▁ to ▁ call ▁ a ▁ taxi , ▁ you ▁ should ▁ call : ▁ { ' , ▁ ' . join ( taxi _ guys ) } . " ) print ( f " If ▁ you ▁ want ▁ to ▁ order ▁ a ▁ pizza , ▁ you ▁ should ▁ call : ▁ { ' , ▁ ' . join ( pizza _ guys ) } . " ) print ( f " If ▁ you ▁ want ▁ to ▁ go ▁ to ▁ a ▁ cafe ▁ with ▁ a ▁ wonderful ▁ girl , ▁ you ▁ should ▁ call : ▁ { ' , ▁ ' . join ( cafe _ guys ) } . " ) NEW_LINE

def main ( ) : n = int ( input ( ) ) arr = [ ] for _ in range ( n ) : k , name = input ( ) . split ( ) arr . append ( [ name , 0 , 0 , 0 ] ) for i in range ( int ( k ) ) : num = input ( ) . replace ( " - " , " " ) if all ( a > b for a , b in zip ( num , num [ 1 : ] ) ) : arr [ - 1 ] [ 2 ] += 1 elif len ( set ( num ) ) == 1 : arr [ - 1 ] [ 1 ] += 1 else : arr [ - 1 ] [ 3 ] += 1   t = [ " If ▁ you ▁ want ▁ to ▁ call ▁ a ▁ taxi , ▁ you ▁ should ▁ call : " , " If ▁ you ▁ want ▁ to ▁ order ▁ a ▁ pizza , ▁ you ▁ should ▁ call : " , " If ▁ you ▁ want ▁ to ▁ go ▁ to ▁ a ▁ cafe ▁ with ▁ a ▁ wonderful ▁ girl , ▁ you ▁ should ▁ call : " ]   for i , s in enumerate ( t , start = 1 ) : m = max ( r [ i ] for r in arr ) print ( s , " , ▁ " . join ( r [ 0 ] for r in arr if r [ i ] == m ) + " . " ) if __name__ == ' _ _ main _ _ ' : main ( ) NEW_LINE


import java . io . * ; import java . util . * ;   public class Main { public static void main ( String args [ ] ) { long s = System . currentTimeMillis ( ) ; FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = 1 ; while ( T -- > 0 ) { int n = input . nextInt ( ) ; int a [ ] = new int [ n ] ; int pre [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextInt ( ) ; if ( i == 0 ) { pre [ i ] = a [ i ] ; } else { pre [ i ] = a [ i ] ^ pre [ i - 1 ] ; } } long xor [ ] [ ] = new long [ 2 ] [ 2000000 ] ; xor [ 1 ] [ 0 ] ++ ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += xor [ i % 2 ] [ pre [ i ] ] ; xor [ i % 2 ] [ pre [ i ] ] ++ ; } 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 . io . * ; import java . util . * ; import java . lang . * ; import java . math . * ; import java . text . DecimalFormat ; import java . lang . reflect . Array ; import java . io . BufferedOutputStream ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . math . BigDecimal ; public class Codeforces { public static PrintWriter out = new PrintWriter ( new BufferedOutputStream ( System . out ) ) ; static long MOD = ( long ) ( 1e9 + 7 ) ; static long MOD2 = MOD * MOD ;

import java . io . * ; import java . util . * ; public class Solution { public static void main ( String ag [ ] ) { Scanner sc = new Scanner ( System . in ) ; int i , j , k ; int N = sc . nextInt ( ) ; long A [ ] = new long [ N + 1 ] ; for ( i = 1 ; i <= N ; i ++ ) { A [ i ] = sc . nextLong ( ) ; } HashMap < Long , Long > odd = new HashMap < > ( ) ; HashMap < Long , Long > even = new HashMap < > ( ) ; odd . put ( 0L , 1L ) ; long xor = 0 ; long ans = 0 ; for ( i = 1 ; i <= N ; i ++ ) { xor ^= A [ i ] ; if ( i % 2 == 0 ) { if ( odd . containsKey ( xor ) ) { ans += odd . get ( xor ) ; odd . put ( xor , odd . get ( xor ) + 1 ) ; } else { odd . put ( xor , 1L ) ; } } else { if ( even . containsKey ( xor ) ) { ans += even . get ( xor ) ; even . put ( xor , even . get ( xor ) + 1 ) ; } else { even . put ( xor , 1L ) ; } } } System . out . println ( ans ) ; } }

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scanner . nextInt ( ) ; } solve ( arr , n ) ; scanner . close ( ) ; }   private static void solve ( int [ ] arr , int n ) { int [ ] prefix = new int [ n ] ; prefix [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { prefix [ i ] = arr [ i ] ^ prefix [ i - 1 ] ; }   int [ ] [ ] cnt = new int [ 2 ] [ ( 1 << 20 ) + 3 ] ; cnt [ 1 ] [ 0 ] = 1 ; long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += cnt [ i % 2 ] [ prefix [ i ] ] ; cnt [ i % 2 ] [ prefix [ i ] ] ++ ; }   System . out . println ( ans ) ; } }

n = int ( input ( ) ) a = [ 0 ] + list ( map ( int , input ( ) . split ( ) ) ) dict_even = { } dict_odd = { } count = 0 xor = 0 for i in range ( 0 , n + 1 ) : xor = xor ^ a [ i ] if ( i % 2 == 0 ) : if xor in dict_even : count += dict_even [ xor ] dict_even [ xor ] += 1 else : dict_even [ xor ] = 1 else : if xor in dict_odd : count += dict_odd [ xor ] dict_odd [ xor ] += 1 else : dict_odd [ xor ] = 1 print ( count ) NEW_LINE

n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) ans = 0 o = { } e = { } x = [ a [ 0 ] ] for i in range ( 1 , n ) : g = a [ i ] ^ x [ - 1 ] x . append ( g ) if g == 0 and i % 2 == 1 : ans = ans + 1 s = [ 0 ] * nfor i in range ( n ) : if i % 2 == 1 : u = o . get ( x [ i ] , - 1 ) if u == - 1 : o [ x [ i ] ] = i else : s [ i ] = s [ u ] + 1 o [ x [ i ] ] = i else : u = e . get ( x [ i ] , - 1 ) if u == - 1 : e [ x [ i ] ] = i else : s [ i ] = s [ u ] + 1 e [ x [ i ] ] = ians = ans + sum ( s ) print ( ans ) NEW_LINE

import sysinput = sys . stdin . readlinen = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) dic1 = { } dic2 = { } dic1 [ 0 ] = 1 ans = 0 curr = 0 for i in range ( n ) : curr = a [ i ] ^ curr if i % 2 == 0 : if curr in dic2 : ans += dic2 [ curr ] dic2 [ curr ] += 1 else : dic2 [ curr ] = 1 else : if curr in dic1 : ans += dic1 [ curr ] dic1 [ curr ] += 1 else : dic1 [ curr ] = 1 print ( ans ) NEW_LINE


import java . util . * ; public class Main { public static void main ( String [ ] args ) { int a , b , ji1 = 0 , ji2 = 0 , ou1 = 0 , ou2 = 0 ; Scanner reader = new Scanner ( System . in ) ; a = reader . nextInt ( ) ; b = reader . nextInt ( ) ; int i , x ; for ( i = 0 ; i < a ; ++ i ) { x = reader . nextInt ( ) ; if ( x % 2 == 1 ) ji1 ++ ; else ou1 ++ ; } for ( i = 0 ; i < b ; ++ i ) { x = reader . nextInt ( ) ; if ( x % 2 == 1 ) ji2 ++ ; else ou2 ++ ; } if ( ji1 > ou2 ) ji1 = ou2 ; if ( ji2 > ou1 ) ji2 = ou1 ; System . out . println ( ji1 + ji2 ) ; } }

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

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

import java . util . ArrayList ; import java . util . Arrays ; import java . util . Scanner ;   public class Singleton_Pattern { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int n_odd = 0 ; int n_even = 0 ; int m_odd = 0 ; int m_even = 0 ;   for ( int i = 0 ; i < n ; i ++ ) { int a = sc . nextInt ( ) ; if ( ( a & 1 ) == 0 ) n_even ++ ; else n_odd ++ ; } for ( int i = 0 ; i < m ; i ++ ) { int b = sc . nextInt ( ) ; if ( ( b & 1 ) == 0 ) m_even ++ ; else m_odd ++ ; } System . out . println ( Integer . min ( n_even , m_odd ) + Integer . min ( n_odd , m_even ) ) ; } }

def count ( l ) : count_even = 0 count_odd = 0 for i in l : if not i % 2 : count_even += 1 else : count_odd += 1 return count_even , count_odd     def main_function ( ) : n , m = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] a = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] b = [ int ( i ) for i in input ( ) . split ( " ▁ " ) ] a_even , a_odd = count ( a ) b_even , b_odd = count ( b ) count_1 = min ( a_even , b_odd ) + min ( b_even , a_odd ) count_2 = min ( b_even , a_odd ) + min ( b_odd , a_even ) return max ( count_2 , count_1 )     print ( main_function ( ) ) NEW_LINE

def odd_check ( n ) : if n % 2 != 0 : return True else : return False   n , m = map ( int , input ( ) . split ( " ▁ " ) ) chests = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) keys = list ( map ( int , input ( ) . split ( " ▁ " ) ) ) chests_o , chests_e , keys_o , keys_e = 0 , 0 , 0 , 0 c = 0 for i in range ( n ) : if chests [ i ] % 2 == 1 : chests_o += 1 else : chests_e += 1 for i in range ( m ) : if keys [ i ] % 2 == 1 : keys_o += 1 else : keys_e += 1 NEW_LINE

I = lambda : map ( int , input ( ) . split ( ) ) n , m = I ( ) x = sum ( a % 2 for a in I ( ) ) y = sum ( b % 2 for b in I ( ) ) print ( min ( x , m - y ) + min ( y , n - x ) ) NEW_LINE

i = lambda : map ( int , input ( ) . split ( ) ) n , m = i ( ) ; a , b = i ( ) , i ( ) x = sum ( x % 2 for x in a ) y = sum ( x % 2 for x in b ) print ( min ( x , m - y ) + min ( y , n - x ) ) NEW_LINE


import java . util . Scanner ; import java . util . Set ; import java . util . HashSet ; import java . util . LinkedList ; import java . util . Queue ;   public class RedBlueButton { public static void main ( String [ ] args ) { int n , m ; Scanner sc = new Scanner ( System . in ) ; n = sc . nextInt ( ) ; m = sc . nextInt ( ) ; System . out . println ( findMoves1 ( n , m ) ) ; }   public static int findMoves ( int n , int m ) { Set < Integer > visited = new HashSet < > ( ) ; Queue < Integer > nodes = new LinkedList < > ( ) ; nodes . add ( n ) ; int moves = 0 ; while ( ! nodes . isEmpty ( ) ) {   if ( nodes . contains ( m ) ) { break ; } Queue < Integer > children = new LinkedList < > ( ) ; while ( ! nodes . isEmpty ( ) ) { Integer num = nodes . poll ( ) ; if ( ! visited . contains ( num ) ) { visited . add ( num ) ; children . add ( num * 2 ) ; children . add ( num - 1 ) ; } } nodes = children ; moves ++ ; } return moves ; }   public static int findMoves1 ( int n , int m ) { int moves = 0 ; while ( m > n ) { if ( m % 2 != 0 ) { m += 1 ; } else { m /= 2 ; } moves ++ ; }   return moves + ( n - m ) ; } }

import java . io . * ; import java . util . * ; import java . util . LinkedList ; import java . util . Queue ;     public class Main { static class Pair { int data , level ; Pair ( int data , int level ) { this . data = data ; this . level = level ; } } public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; Set < Integer > numberSet = new HashSet < Integer > ( ) ; Queue < Pair > q = new LinkedList < Pair > ( ) ; q . add ( new Pair ( n , 0 ) ) ; while ( ! q . isEmpty ( ) ) { Pair current = q . remove ( ) ; if ( current . data == m ) { System . out . println ( current . level ) ; return ; } int newDouble = current . data * 2 ; int newLess = current . data - 1 ; if ( ! numberSet . contains ( newDouble ) ) { if ( current . data <= m ) { q . add ( new Pair ( newDouble , current . level + 1 ) ) ; numberSet . add ( newDouble ) ; } } if ( ! numberSet . contains ( newLess ) ) { q . add ( new Pair ( newLess , current . level + 1 ) ) ; numberSet . add ( newLess ) ; } } return ; } }

import java . util . Scanner ;   public class codeforces { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; long start = in . nextLong ( ) ; long end = in . nextLong ( ) ; int click = 0 ; while ( start < end ) { if ( end % 2 == 0 ) { end /= 2 ; } else { end += 1 ; } click ++ ; } System . out . println ( click + start - end ) ; } }

import java . util . Scanner ;   public class code { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; int n = scan . nextInt ( ) ; int m = scan . nextInt ( ) ; int count = 0 ; while ( m > n ) { if ( m % 2 != 0 ) { m ++ ; count ++ ; } m /= 2 ; count ++ ; }   System . out . println ( count + n - m ) ; }    }

import java . util . Arrays ; import java . util . Scanner ;   public class solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; if ( n == m ) { System . out . println ( 0 ) ; return ; } if ( n > m ) { System . out . print ( n - m ) ; return ; } int step = 0 ; while ( n < m ) { step ++ ; m = m % 2 == 0 ? m / 2 : m + 1 ; } System . out . println ( step + n - m ) ; } }

def f ( x , y ) : if x >= y : return ( x - y ) else : if y % 2 != 0 : return ( f ( x , y + 1 ) + 1 ) else : return ( f ( x , y / 2 ) + 1 ) a , b = ( input ( " " ) . split ( ) ) x = int ( a ) y = int ( b ) print ( int ( f ( x , y ) ) ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) q = 0 while n != m : m = [ m // 2 , m + 1 ] [ m & 1 or m < n ] q += 1 print ( q ) NEW_LINE

from collections import deque   n , m = map ( int , input ( ) . split ( ) ) a = [ 1000000 ] * 10100 a [ n ] = 0 q = deque ( ) q . append ( n ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) ) cnt = 0 while m > n : if m % 2 : m = m // 2 + 1 cnt += 2 else : m //= 2 cnt += 1 print ( n - m + cnt ) NEW_LINE

n , m = map ( int , input ( ) . split ( ) )   queue = [ n ] depth = 0 list_of_visited = [ ] for i in range ( 2 * ( 10 ** 4 ) + 1 ) : list_of_visited . append ( - 1 ) list_of_visited [ n ] = 0 while True : a = queue . pop ( 0 ) if a == m : my_ans = list_of_visited [ a ] break   if a - 1 > 0 and list_of_visited [ a - 1 ] == - 1 : queue . append ( a - 1 ) list_of_visited [ a - 1 ] = list_of_visited [ a ] + 1 if a < 10 ** 4 and list_of_visited [ a * 2 ] == - 1 : queue . append ( a * 2 ) list_of_visited [ a * 2 ] = list_of_visited [ a ] + 1 print ( my_ans ) NEW_LINE


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

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

n , m = map ( int , input ( ) . split ( ) ) t = [ input ( ) for i in range ( n ) ] p = list ( zip ( * t ) ) u , v = [ True ] * n , [ True ] * mx , u [ n - 1 ] , d = [ n - 1 ] , False , 0 while x : y = [ ] for i in x : for j , k in enumerate ( t [ i ] ) : if k == ' # ' and v [ j ] : v [ j ] = False y . append ( j ) x = [ ] for i in y : for j , k in enumerate ( p [ i ] ) : if k == ' # ' and u [ j ] : u [ j ] = False x . append ( j ) d += 1 if 0 in x : print ( 2 * d ) breakelse : print ( - 1 ) NEW_LINE

from collections import dequefrom collections import defaultdict   n , m = map ( int , input ( ) . split ( ) ) INF = 10 ** 9 visited = defaultdict ( int )   g = [ [ ] for _ in range ( n + m ) ] NEW_LINE


import java . util . Scanner ;   public class A907 {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; int V1 = in . nextInt ( ) ; int V2 = in . nextInt ( ) ; int V3 = in . nextInt ( ) ; int Vm = in . nextInt ( ) ; for ( int x = V1 ; x <= 2 * V1 ; x ++ ) { for ( int y = V2 ; y <= 2 * V2 ; y ++ ) { if ( x <= y ) continue ; for ( int z = V3 ; z <= 2 * V3 ; z ++ ) { if ( y <= z ) continue ; if ( z < Vm ) continue ; if ( z > 2 * Vm ) continue ; if ( y <= 2 * Vm ) continue ; System . out . println ( x + " \n " + y + " \n " + z ) ; return ; } } } System . out . println ( " - 1" ) ; }   }

import java . util . * ; import java . util . stream . Collectors ; import java . util . stream . Stream ;   import static java . lang . Integer . max ; import static java . lang . Integer . reverse ; import static java . lang . Math . min ;   public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , c = sc . nextInt ( ) , d = sc . nextInt ( ) ; if ( b > d && c + c >= d && d + d >= c ) { System . out . printf ( " % d \n % d \n % d " , max ( a , max ( c , d ) * 2 + 2 ) , max ( b , max ( c , d ) * 2 + 1 ) , max ( c , d ) ) ; } else System . out . println ( - 1 ) ; } }

import java . util . * ; import java . awt . * ;    public class p907A { public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; int dad = in . nextInt ( ) ; int mom = in . nextInt ( ) ; int son = in . nextInt ( ) ; int marsha = in . nextInt ( ) ;   int dadCar = dad ; int momCar = mom ; int sonCar = son ;   while ( marsha * 2 >= dadCar ) { dadCar ++ ; }   while ( marsha * 2 >= momCar ) { momCar ++ ; }   while ( marsha * 2 < sonCar ) { sonCar -- ; }   while ( marsha > sonCar ) { sonCar ++ ; }   while ( momCar <= sonCar ) { momCar ++ ; } while ( dadCar <= momCar ) { dadCar ++ ; }   if ( dadCar <= dad * 2 && momCar <= mom * 2 && sonCar <= son * 2 && sonCar <= marsha * 2 && sonCar >= son ) { System . out . println ( dadCar ) ; System . out . println ( momCar ) ; System . out . println ( sonCar ) ; } else { System . out . println ( - 1 ) ; }     } }

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

father_size , mother_size , son_size , masha_size = list ( map ( int , input ( ) . split ( ) ) )   son_car = 0 father_car = 0 mother_car = 0 t = max ( masha_size , son_size ) for car_size in range ( t , 201 ) : if ( 2 * t ) >= car_size and ( 2 * son_size ) >= car_size and ( 2 * masha_size ) >= car_size : son_car = car_size breakfor car_size in range ( mother_size , 201 ) : if ( 2 * mother_size ) >= car_size and ( car_size > ( 2 * t ) ) : mother_car = car_size break for car_size in range ( father_size , 201 ) : if ( 2 * father_size ) >= car_size and car_size > mother_car : father_car = car_size break if father_car and mother_car and son_car : print ( father_car ) print ( mother_car ) print ( son_car ) else : print ( - 1 ) NEW_LINE

en = list ( map ( int , input ( ) . split ( ) ) ) a , b , c , d = en [ 0 ] , en [ 1 ] , en [ 2 ] , en [ 3 ]   aux = max ( c , d )   if ( 2 * c >= aux and 2 * d >= aux and 2 * d < 2 * a and 2 * d < 2 * b ) : print ( 2 * a ) print ( 2 * b ) print ( aux ) else : print ( - 1 ) NEW_LINE

def aaa ( ) : a , b , c , d = map ( int , input ( ) . split ( ) ) for aa in range ( a , 2 * a + 1 ) : for bb in range ( b , min ( aa , 2 * b + 1 ) ) : for cc in range ( c , min ( bb , 2 * c + 1 ) ) : if d <= aa and aa > d * 2 and d <= bb and bb > d * 2 and d <= cc and cc <= d * 2 : return [ aa , bb , cc ] return [ - 1 ] for aa in aaa ( ) : print ( aa ) NEW_LINE

pai , mae , filho , maria = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] def solve ( ) : if filho > 2 * maria or maria > 2 * filho or maria >= mae : return - 1 if filho > maria : return max ( pai , 2 * maria + 2 ) , max ( mae , 2 * maria + 1 ) , filho return max ( pai , 2 * maria + 2 ) , max ( mae , 2 * maria + 1 ) , maria x = solve ( ) if x == - 1 : print ( - 1 ) else : print ( x [ 0 ] ) print ( x [ 1 ] ) print ( x [ 2 ] ) NEW_LINE


import java . util . * ; public class Solution { public static void main ( String [ ] args ) { Scanner s = new Scanner ( System . in ) ; int t = s . nextInt ( ) ; for ( int i = 0 ; i < t ; i ++ ) { int a = s . nextInt ( ) ; int b = s . nextInt ( ) ; int count = 0 ; int d = Math . abs ( a - b ) ; count = count + d / 5 ; d = d % 5 ; count = count + d / 2 ; d = d % 2 ; count = count + d ; System . out . println ( count ) ; } } }

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

import java . util . * ; import java . io . * ; public class Main { public static void main ( String [ ] args ) throws IOException { Scanner in = new Scanner ( new BufferedReader ( new InputStreamReader ( System . in ) ) ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( System . out ) ) ; int t = in . nextInt ( ) ; while ( t -- != 0 ) { int a = in . nextInt ( ) ; int b = in . nextInt ( ) ; if ( a > b ) { int c = a ; a = b ; b = c ; } int res = b - a ; int ans = res / 10 * 2 ; res %= 10 ; int [ ] nums = new int [ ] { 0 , 1 , 1 , 2 , 2 , 1 , 2 , 2 , 3 , 3 , 2 } ; ans += nums [ res ] ; out . println ( ans ) ; } in . close ( ) ; out . flush ( ) ; } }

import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . * ; public class C { static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] nextArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } } static class FastWriter extends PrintWriter { FastWriter ( ) { super ( System . out ) ; }   void println ( int [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; }   void println ( long [ ] array ) { for ( int i = 0 ; i < array . length ; i ++ ) { print ( array [ i ] + " ▁ " ) ; } println ( ) ; } } public static void main ( String [ ] args ) {

t = int ( input ( ) ) while ( t ) : a , b = map ( int , input ( ) . split ( ) ) if a < b : a , b = b , a ans = ( a - b ) // 5 m = ( a - b ) % 5 if m == 1 or m == 2 : ans += 1 elif m == 3 or m == 4 : ans += 2 print ( ans ) t -= 1 NEW_LINE

t = int ( input ( ) ) for i in range ( t ) : a , b = list ( map ( int , input ( ) . split ( ) ) ) d = abs ( a - b ) print ( int ( d / 5 ) + int ( d % 5 / 2 ) + d % 5 % 2 ) NEW_LINE

n = int ( input ( ) ) for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) c = abs ( a - b ) print ( c // 5 + ( c % 5 ) // 2 + ( c % 5 ) % 2 ) NEW_LINE

for i in range ( int ( input ( ) ) ) : a , b = map ( int , input ( ) . split ( ) ) d = abs ( a - b ) print ( d // 5 + d % 5 // 2 + d % 5 % 2 ) NEW_LINE

def result ( c ) : count = 0 if c >= 5 : count = count + c // 5 c = c - ( c // 5 ) * 5 if c >= 2 : count = count + c // 2 c = c - ( c // 2 ) * 2 if c == 1 : count = count + c c = c - c print ( count ) def calculate ( a , b ) : if a == b : print ( '0' ) elif a > b : result ( a - b ) else : result ( b - a ) test = int ( input ( ) ) while test : a , b = map ( int , input ( ) . split ( " ▁ " ) ) calculate ( a , b ) test -= 1 NEW_LINE


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

import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] a = new int [ 101 ] ; for ( int i = 0 ; i < n ; i ++ ) a [ sc . nextInt ( ) ] ++ ; int count = 0 ; while ( a [ k ] != n ) { for ( int i = k - 1 ; i > 0 ; i -- ) { if ( a [ i ] > 0 ) { a [ i ] -- ; a [ i + 1 ] ++ ; } } count ++ ; } System . out . println ( count ) ; sc . close ( ) ; } }

import java . io . * ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . * ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;    public class Main1 {    public static void main ( String [ ] args ) {   try {    FastScanner in = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;    int n = in . nextInt ( ) ; int k = in . nextInt ( ) ; int A [ ] = in . readArray ( n ) ; int ct = 0 ; int ptr = 100000 ;   while ( ptr -- > 0 ) { boolean flag = false ; int prev = k ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( A [ i ] >= k ) continue ;   flag = true ; if ( A [ i ] != prev ) { prev = A [ i ] ; A [ i ] ++ ; }   } if ( flag ) ct ++ ; else break ; }   System . out . println ( ct ) ;                              out . flush ( ) ; out . close ( ) ;    } catch ( Exception e ) { return ; }                      }    static class FastScanner { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   int [ ] readArray ( int n ) { int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = nextInt ( ) ; return a ; }    long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } }    }

n , k = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] NEW_LINE a = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] NEW_LINE a_dict = { i : 0 for i in range ( k + 1 ) } NEW_LINE for x in a : if NEW_LINE x in a_dict : a_dict [ x ] += 1 else : a_dict [ x ] = 1 NEW_LINE steps = 0 NEW_LINE while a_dict [ k ] < n : a_dict = { i : a_dict [ i ] - int ( a_dict [ i ] > 0 and i < k ) + int ( i > 0 and a_dict [ i - 1 ] > 0 ) for i in range ( 1 , k + 1 ) } NEW_LINE a_dict [ 0 ] = 0 NEW_LINE steps += 1 NEW_LINE print ( steps ) NEW_LINE

n , k = [ int ( i ) for i in input ( ) . split ( ) ] NEW_LINE a = list ( map ( int , input ( ) . split ( ) ) ) [ : n ] NEW_LINE b = 0 NEW_LINE while a . count ( k ) != len ( a ) : for NEW_LINE i in set ( a ) : NEW_LINE if i != k : x = a . index ( i ) NEW_LINE a [ x ] = a [ x ] + 1 NEW_LINE b = b + 1 NEW_LINE print ( b ) NEW_LINE

def solve ( x , a ) : a . sort ( ) NEW_LINE c = 0 NEW_LINE while a [ 0 ] != x : for NEW_LINE i in range ( len ( a ) ) : NEW_LINE if i != len ( a ) - 1 : if NEW_LINE a [ i ] != a [ i + 1 ] : a [ i ] = a [ i ] + 1 else : a [ i ] = a [ i ] + 1 NEW_LINE

from collections import Counter   if __name__ == ' _ _ main _ _ ' : cin = input NEW_LINE n , k = map ( int , cin ( ) . split ( ) ) NEW_LINE d , cnt = Counter ( [ int ( i ) for i in cin ( ) . split ( ) ] ) , 0 NEW_LINE while d [ k ] < n : for NEW_LINE i in range ( k - 1 , 0 , - 1 ) : NEW_LINE if d [ i ] : d [ i + 1 ] += 1 NEW_LINE d [ i ] -= 1 NEW_LINE cnt += 1 NEW_LINE print ( cnt ) NEW_LINE


import java . util . * ; import java . io . * ;   public class Main { static class FastReader { BufferedReader br ; StringTokenizer st ;   public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; }   String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } }   public static void main ( String [ ] args ) { FastReader fr = new FastReader ( ) ; Scanner sc = new Scanner ( System . in ) ; int a = fr . nextInt ( ) , b = fr . nextInt ( ) , ab = fr . nextInt ( ) ; long ans = ab * 2L ; if ( a == b ) ans += 2L * a ; else ans += Math . min ( a , b ) * 2L + 1L ; System . out . println ( ans ) ; } }

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

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

def insertion_sort ( l ) : for i in range ( len ( l ) ) : for j in ( range ( i ) ) : k = i - j if l [ k ] >= l [ k - 1 ] : l [ k - 1 ] , l [ k ] = l [ k ] , l [ k - 1 ] else : break return l       def selection_sort ( l ) : for i in range ( len ( l ) ) : min_ind = i min_val = l [ i ] for j in range ( i , len ( l ) ) : if min_val > l [ j ] : min_val = l [ j ] min_ind = j l [ i ] , l [ min_ind ] = l [ min_ind ] , l [ i ] return l     def bubble_sort ( l ) : for i in range ( len ( l ) - 1 ) : for j in range ( len ( l ) - 1 - i ) : if l [ j ] > l [ j + 1 ] : l [ j ] , l [ j + 1 ] = l [ j + 1 ] , l [ j ] return l     NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) if a < b : s = ( a * 2 + c * 2 ) else : s = ( b * 2 + c * 2 ) if a != b : s += 1 print ( s )   NEW_LINE

a , b , c = map ( int , input ( ) . split ( ) ) print ( 2 * min ( a , b ) + 2 * c + ( 0 if a == b else 1 ) ) NEW_LINE

temp = [ int ( x ) for x in input ( ) . split ( ) ] a = temp [ 0 ] b = temp [ 1 ] c = temp [ 2 ] x = a + cy = b + cif a > b : print ( 2 * c + 2 * b + 1 ) elif b > a : print ( 2 * c + 2 * a + 1 ) else : print ( 2 * c + 2 * a ) NEW_LINE

import sys   def main ( ) : a , b , c = map ( int , sys . stdin . read ( ) . strip ( ) . split ( ) ) return c * 2 + min ( a , b ) * 2 + bool ( b - a ) print ( main ( ) ) NEW_LINE


import java . util . * ; import java . text . * ;   public class B { static String [ ] s1 = null , s2 = null ; static int [ ] ss2 = new int [ 3 ] ; static Vector < Date > dates = new Vector < > ( ) ; static final String fs = " dd / MM / yyyy " ; static SimpleDateFormat format = new SimpleDateFormat ( fs ) ;   public static int age ( Date birthday , Date date ) { DateFormat formatter = new SimpleDateFormat ( " yyyyMMdd " ) ; int d1 = Integer . parseInt ( formatter . format ( birthday ) ) ; int d2 = Integer . parseInt ( formatter . format ( date ) ) ; int age = ( d2 - d1 ) / 10000 ; return age ; }   public static boolean val ( String x , String y , String z ) { try { format . parse ( x + " / " + y + " / " + "20" + z ) ; } catch ( ParseException e ) { return false ; } catch ( IllegalArgumentException e ) { return false ; } return true ; }   public static void main ( String [ ] args ) throws Exception { Scanner in = new Scanner ( System . in ) ; s1 = in . next ( ) . split ( " \\ . " ) ; s2 = in . next ( ) . split ( " \\ . " ) ; format . setLenient ( false ) ; for ( int i = 0 ; i < s2 . length ; i ++ ) ss2 [ i ] = Integer . parseInt ( s2 [ i ] ) ; Date d1 = format . parse ( s1 [ 0 ] + " / " + s1 [ 1 ] + " / 20" + s1 [ 2 ] ) ;   if ( val ( s2 [ 0 ] , s2 [ 1 ] , s2 [ 2 ] ) ) dates . add ( format . parse ( s2 [ 0 ] + " / " + s2 [ 1 ] + " / 20" + s2 [ 2 ] ) ) ;

t = tuple ( map ( int , input ( ) . split ( ' . ' ) ) )   dc = ( 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 )   def f ( d , m , y ) :   if m not in range ( 13 ) or d > dc [ m ] + ( m == 2 and y % 4 == 0 ) :   return False   else :   return t [ 2 ] - y > 18 or t [ 2 ] - y == 18 and ( m , d ) <= ( t [ 1 ] , t [ 0 ] )   a , b , c = map ( int , input ( ) . split ( ' . ' ) )   print ( ' YES ' if any ( ( f ( a , b , c ) , f ( a , c , b ) , f ( b , a , c ) , f ( b , c , a ) , f ( c , a , b ) , f ( c , b , a ) ) ) else ' NO ' )       NEW_LINE

d , m , y = map ( int , input ( ) . split ( ' . ' ) ) a , b , c = map ( int , input ( ) . split ( ' . ' ) )   months = [ 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 ] count = 0 while ( count < 6 ) : if b < c and c in range ( 13 ) and months [ c ] >= a + ( b % 4 == 0 and b == 2 ) : temp = b b = c c = temp count = 0 else : count += 1 if a < c and c <= ( months [ b ] + ( a % 4 == 0 and b == 2 ) ) : temp = c c = a a = temp count = 0 else : count += 1 if a < b and a in range ( 13 ) : temp = a a = b b = tempcount = 0 if y - c > 18 : print ( " YES " ) elif y - c == 18 : if m > b : print ( " YES " ) elif m == b : if d >= a : print ( " YES " ) else : print ( " NO " ) else : print ( " NO " ) else : print ( " NO " )   NEW_LINE