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 ; }


k = int ( input ( ) ) l = list ( map ( int , input ( ) . split ( ) ) ) r = 0 e = 0 l . sort ( ) q0 = 0 q1 = 0 q11 = 0 q10 = 0 q100 = 0 r1 = [ ] for i in range ( k ) : if ( l [ i ] == 0 ) : q0 = q0 + 1 elif ( l [ i ] > 0 and l [ i ] < 10 ) : q1 = q1 + 1 elif ( l [ i ] == 100 ) : q100 = q100 + 1 elif ( l [ i ] % 10 == 0 ) : q10 = q10 + 1 elif ( l [ i ] > 10 and l [ i ] % 10 != 0 ) : q11 = q11 + 1 if ( q0 > 0 ) : r1 . append ( 0 ) r = r + 1 if ( q100 > 0 ) : r1 . append ( 100 ) r = r + 1 temp = rif ( q10 > 0 ) : for i in range ( k ) : if ( l [ i ] > 9 and l [ i ] < 100 and l [ i ] % 10 == 0 ) : r = r + 1 e = 1 r1 . append ( l [ i ] ) breaktemp1 = rif ( q1 > 0 ) : for i in range ( k ) : if ( l [ i ] > 0 and l [ i ] < 10 ) : r = r + 1 r1 . append ( l [ i ] ) breakif ( r == 0 or ( temp1 == r and q11 > 0 and ( q0 > 0 or q100 > 0 ) and e == 0 ) ) : for i in range ( k ) : if ( l [ i ] > 10 and l [ i ] % 10 != 0 ) : r = r + 1 r1 . append ( l [ i ] ) breakprint ( r ) for i in range ( r ) : print ( r1 [ i ] , end = " ▁ " ) NEW_LINE


from collections import defaultdictn = int ( input ( ) ) arr = [ int ( x ) for x in input ( ) . split ( ) ] ans = [ ] d = defaultdict ( bool ) for i in arr : if ( i == 0 ) : ans . append ( i ) elif ( i % 100 == 0 and not d [ 100 ] ) : d [ 100 ] = True ans . append ( i ) elif ( i % 10 == 0 and not d [ 10 ] ) : d [ 10 ] = True ans . append ( i ) if ( d [ 10 ] ) : for i in arr : if ( '0' not in str ( i ) and len ( str ( i ) ) == 1 ) : ans . append ( i ) breakelse : for i in arr : if ( '0' not in str ( i ) ) : ans . append ( i ) breakprint ( len ( ans ) ) print ( * ans )   NEW_LINE


k = int ( input ( ) )   zlist2 = [ int ( d ) for d in input ( ) . split ( ) ] zlist2 . sort ( )   if k == 1 : print ( k ) print ( str ( zlist2 [ 0 ] ) ) exit ( )   res = [ ]   dicti = { } dicti [ 0 ] = Falsedicti [ 100 ] = Truedicti [ '0-10' ] = Falsedicti [ '10-100' ] = False   cnt = 0 for x in zlist2 : if x == 0 : res . append ( '0' ) elif x == 100 : res . append ( '100' ) if 0 < x < 10 and dicti [ '0-10' ] == False : cnt += 1 res . append ( str ( x ) ) dicti [ '0-10' ] = True if 9 < x < 100 and dicti [ '10-100' ] == False and x % 10 == 0 : cnt += 1 res . append ( str ( x ) ) dicti [ '10-100' ] = True   if cnt == 0 : for y in zlist2 : if 9 < y < 100 and y % 10 != 0 : res . append ( str ( y ) ) breakprint ( len ( res ) ) print ( ' ▁ ' . join ( res ) )   NEW_LINE


import java . util . Scanner ;   public class StrangeAddition {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = sc . nextInt ( ) ; } int sum = 0 ; int c = 0 ; String s = " " ; int checkSingle = - 1 ; int checkDouble = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 0 || arr [ i ] == 100 ) { c ++ ; s = s + arr [ i ] + " ▁ " ; } else if ( arr [ i ] % 10 == 0 && checkDouble == - 1 ) { c ++ ; checkDouble = 0 ; s = s + arr [ i ] + " ▁ " ; } else if ( arr [ i ] / 10 == 0 && checkSingle == - 1 ) { c ++ ; checkSingle = 0 ; s = s + arr [ i ] + " ▁ " ; } } if ( checkDouble == - 1 && checkSingle == - 1 ) { for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != 0 && arr [ i ] != 100 ) { c ++ ; s = s + arr [ i ] + " ▁ " ; break ; } } } if ( c == 0 ) { System . out . println ( 1 ) ; System . out . println ( arr [ 0 ] ) ; return ; } System . out . println ( c ) ; System . out . println ( s ) ; }   private static boolean add ( int a , int b ) { while ( a % 10 == 0 || b % 10 == 0 ) { if ( a == 0 || b == 0 ) return true ; a = a / 10 ; b = b / 10 ; } return false ; }   }

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) t = [ ] flag = 0 if ( 0 in arr ) : t . append ( 0 ) if ( 100 in arr ) : t . append ( 100 ) for i in range ( n ) : if ( arr [ i ] > 0 and arr [ i ] < 10 ) : t . append ( arr [ i ] ) flag = 1 breakfor i in range ( n ) : if ( arr [ i ] % 10 == 0 and arr [ i ] > 0 and arr [ i ] < 100 ) : t . append ( arr [ i ] ) flag = 1 breakif ( flag == 0 ) : for i in range ( n ) : if ( arr [ i ] > 10 and arr [ i ] < 100 ) : t . append ( arr [ i ] ) breakprint ( len ( t ) ) for i in range ( len ( t ) ) : print ( t [ i ] , end = " ▁ " ) NEW_LINE


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

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


n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) maxnum = max ( arr ) total = 0 for num in arr : total += ( abs ( maxnum - num ) ) print ( total ) NEW_LINE


from collections import Counterimport math   def solve ( ) : n = int ( input ( ) ) array = list ( map ( int , input ( ) . split ( ) ) ) count = 0 array . sort ( )   for i in range ( n - 1 ) : count += abs ( array [ i ] - array [ n - 1 ] )   return count   print ( solve ( ) ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) print ( n * max ( a ) - sum ( a ) ) NEW_LINE


peoples = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) count = 0 max_ = max ( arr ) for num in arr : count += max_ - numprint ( count ) NEW_LINE


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


import java . util . Arrays ; import java . util . Collections ; import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; Integer [ ] arr = new Integer [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; Arrays . sort ( arr ) ; int max = Collections . max ( Arrays . asList ( arr ) ) ; int sum = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { sum += max - arr [ i ] ; } System . out . println ( sum ) ; } }


import java . util . * ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; ArrayList < Integer > ar = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { ar . add ( sc . nextInt ( ) ) ; } int max = Collections . max ( ar ) ; int ans = 0 ; for ( int j = 0 ; j < n ; j ++ ) { ans = ans + max - ar . get ( j ) ; } System . out . println ( ans ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . StringTokenizer ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   public class Main { public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; FastScanner in = new FastScanner ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; BQueueAtTheSchool solver = new BQueueAtTheSchool ( ) ; solver . solve ( 1 , in , out ) ; out . close ( ) ; }   static class BQueueAtTheSchool { public void solve ( int testNumber , FastScanner fs , PrintWriter out ) { int n = fs . nextInt ( ) , t = fs . nextInt ( ) ; char [ ] q = fs . next ( ) . toCharArray ( ) ; for ( int tt = 0 ; tt < t ; tt ++ ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( q [ i ] == ' B ' && q [ i + 1 ] == ' G ' ) { q [ i ] = ' G ' ; q [ i + 1 ] = ' B ' ; i ++ ; } } } String ans = new String ( q ) ; out . println ( ans ) ; }   }   static class FastScanner { BufferedReader br ; StringTokenizer st ;   public FastScanner ( InputStream inputStream ) { br = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; }   public String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   } }

def ret ( inp ) : lst = inp . copy ( ) for i in range ( len ( inp ) ) : if inp [ i ] == ' G ' : j = i - 1 k = t if j >= 0 and inp [ j ] == ' B ' : lst [ j + 1 ] = ' B ' lst [ j ] = ' G ' return lstn , t = [ int ( x ) for x in input ( ) . split ( ) ] inp = input ( ) inp_lst = [ ] for c in inp : inp_lst . append ( c ) for c in range ( t ) : inp_lst = ret ( inp_lst )   lst_str = " " . join ( inp_lst ) print ( lst_str ) NEW_LINE


import sys   input = sys . stdin . readline   sys . setrecursionlimit ( 10 ** 5 + 1 )   n , t = map ( int , input ( ) . split ( ) ) s = list ( input ( ) )   for i in range ( t ) : j = 1 while j < n : if s [ j - 1 ] == " B " and s [ j ] == " G " : s [ j - 1 ] , s [ j ] = " G " , " B " j += 1 j += 1 print ( * s , sep = " " ) NEW_LINE


import copy   n , t = list ( map ( int , input ( ) . split ( ) ) ) queue = list ( input ( ) ) bqueue = [ ' N ' for i in range ( n ) ]   while t > 0 : t -= 1   bqueue [ 0 ] = queue [ 0 ]   for i in range ( n - 1 ) : if queue [ i ] == " B " and queue [ i + 1 ] == " G " : bqueue [ i ] = " G " bqueue [ i + 1 ] = " B " else : if bqueue [ i ] == ' N ' : bqueue [ i ] = queue [ i ] bqueue [ i + 1 ] = queue [ i + 1 ]   queue = copy . deepcopy ( bqueue ) bqueue = [ ' N ' for i in range ( n ) ]   print ( " " . join ( queue ) ) NEW_LINE


x = input ( ) . split ( ) q = input ( ) newq = " " ans = " " for thing in q : newq += thing + " ▁ " newq = newq . split ( ) ppl = int ( x [ 0 ] ) time = int ( x [ 1 ] ) for second in range ( time ) : counter = 0 while counter < len ( newq ) - 1 : if newq [ counter ] == " B " and newq [ counter + 1 ] == " G " : newq [ counter ] , newq [ counter + 1 ] = newq [ counter + 1 ] , newq [ counter ] counter += 1 counter += 1 for thing in newq : ans += thingprint ( ans ) NEW_LINE


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


import java . io . * ; import java . util . Scanner ; public class Solution { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { try { System . setOut ( new PrintStream ( new FileOutputStream ( " output . txt " ) ) ) ; sc = new Scanner ( new File ( " input . txt " ) ) ; } catch ( Exception e ) { } }


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ;   int n = in . nextInt ( ) ; int t = in . nextInt ( ) ; in . nextLine ( ) ; String s = in . nextLine ( ) ;   char [ ] a = s . toCharArray ( ) ;   for ( int step = 0 ; step < t ; step ++ ) { for ( int i = 0 ; i < a . length - 1 ; i ++ ) { if ( a [ i ] == ' B ' && a [ i + 1 ] == ' G ' ) { a [ i ] = ' G ' ; a [ i + 1 ] = ' B ' ; i ++ ; } } }   System . out . println ( new String ( a ) ) ; } }


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


import java . util . * ; import java . io . * ; import java . math . * ;     public class B {   private static long INF = 2000000000000000000L , M = 1000000007 , MM = 998244353 ; private static int N = 0 ;   public static void process ( ) throws IOException {   long n = sc . nextLong ( ) , g = sc . nextLong ( ) , b = sc . nextLong ( ) ; long req = n / 2 ; if ( n % 2 == 1 ) req ++ ; long l = 1 , r = Integer . MAX_VALUE ; long ans = 1 ; while ( l <= r ) { long mid = ( l + r ) / 2 ; if ( mid * g >= req ) { ans = mid ; r = mid - 1 ; } else { l = mid + 1 ; } } long res = b * ( ans - 1 ) ; res += ( ans - 1 ) * g ; req -= ( ( ans - 1 ) * g ) ; res += req ; long max = max ( res , n ) ; System . out . println ( max ) ;   }

import matht = int ( input ( ) ) anss = [ ] while t : n , a , b = map ( int , input ( ) . split ( ) ) ans = 0 if a >= b : ans = n else : m = math . ceil ( n / 2 ) if m % a == 0 : ans = m + ( ( m // a ) - 1 ) * b else : ans = m + ( m // a ) * b anss . append ( max ( ans , n ) ) t = t - 1 for i in anss : print ( i ) NEW_LINE


import mathfor _ in range ( int ( input ( ) ) ) : n , g , b = map ( int , input ( ) . split ( ) ) if ( n <= g ) : print ( n ) else :   total = g + b y = math . ceil ( n / 2 ) d = y // g ans = d * total work = y if ( y - d * g > 0 ) : ans = ans + y - d * g else : ans = ans - b print ( max ( ans , n ) ) NEW_LINE


from sys import stdin , stdoutinput = stdin . readline def main ( ) : q = int ( input ( ) ) for i in range ( q ) : n , g , b = map ( int , input ( ) . split ( ) ) num = ( n + 1 ) // 2 temp = ( num - 1 ) // g print ( max ( n , temp * ( g + b ) + num - temp * g ) ) main ( ) NEW_LINE


t = int ( input ( ) ) for i in range ( t ) : n , g , b = map ( int , input ( ) . split ( ) ) q = n // 2 + n % 2 ans = 0 if ( q % g == 0 ) : ans = q // g ans = ( ans * g ) + ( ( ans - 1 ) * b ) else : ans = q // g + 1 ans = ( ( ans - 1 ) * ( g + b ) ) + ( q % g ) print ( max ( n , ans ) ) NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . PrintWriter ; import java . util . StringTokenizer ;   public class NationalProject { private static final FastReader in = new FastReader ( ) ; private static final PrintWriter pw = new PrintWriter ( System . out ) ;   public static void main ( String [ ] args ) { Solver sol = new Solver ( ) ; int tt = 1 ; for ( int qq = in . nextInt ( ) ; tt <= qq ; tt ++ ) sol . solve ( tt ) ; pw . close ( ) ; }   private static class Solver { public void solve ( int testCase ) { long n = Long . parseLong ( in . next ( ) ) , g = Long . parseLong ( in . next ( ) ) , b = Long . parseLong ( in . next ( ) ) ;


import java . io . BufferedInputStream ; import java . math . BigDecimal ; import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int n = 0 ; long half = 0 , gd = 0 , bd = 0 ; while ( n < N ) { long length = sc . nextLong ( ) ; long g = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; long time = 0 ;   if ( length % 2 == 1 ) { half = length / 2 + 1 ; } else half = length / 2 ;   if ( half % g == 0 ) { time = ( half / g ) * ( b + g ) - b ; } else { time = ( half / g ) * ( b + g ) + half % g ; }   time = Math . max ( time , length ) ; System . out . println ( time ) ; n ++ ;    } } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System . in ) ; int t = input . nextInt ( ) ; while ( t -- != 0 ) { long n = input . nextInt ( ) ; long g = input . nextInt ( ) ; long b = input . nextInt ( ) ; long half = ( n + 1 ) / 2 ; long ans = half / g * ( g + b ) ; if ( half % g == 0 ) { ans -= b ; } else { ans += half % g ; } System . out . println ( ( long ) Math . max ( ans , n ) ) ; } } }


# include < cstdio > # include < iostream > # include < string > # include < cstring > # include < algorithm > # include < queue > # include < cmath > # include < fstream > # include < stack > # include < set > using namespace std ; typedef long long LL ; const int maxn = 1e6 + 100 ; const int maxm = 1e6 + 100 ; const int INF = 1 << 30 ; struct Edge { int u , v , w , f , next ; } e [ maxm ] , tmp [ maxm ] ; int head [ maxn ] , tot = 1 ; void addEdge ( int u , int v , int f , int w ) { e [ ++ tot ] . u = u ; e [ tot ] . v = v ; e [ tot ] . f = f ; e [ tot ] . w = w ; e [ tot ] . next = head [ u ] ; head [ u ] = tot ;

from sys import stdin , stdoutfrom NEW_LINE collections NEW_LINE import dequeimport NEW_LINE sys   graph = [ ] NEW_LINE n = 0 NEW_LINE current_graph = [ ] NEW_LINE pair_f = [ ] NEW_LINE pair_a = [ ] NEW_LINE dist = [ ]     NEW_LINE def dfs ( s ) : global pair_f NEW_LINE global pair_a NEW_LINE global dist   if s != 0 : for NEW_LINE a in current_graph [ s ] : NEW_LINE if dist [ pair_a [ a ] ] == ( dist [ s ] + 1 ) : if NEW_LINE dfs ( pair_a [ a ] ) : pair_a [ a ] = s NEW_LINE pair_f [ s ] = a NEW_LINE return True   dist [ s ] = 10 ** 4 + 1 NEW_LINE return False   return True     NEW_LINE def bfs ( ) : global dist NEW_LINE   q = deque ( ) NEW_LINE inf = 10 ** 4 + 1 NEW_LINE for f in range ( 1 , n + 1 ) : NEW_LINE


import osimport NEW_LINE sysfrom NEW_LINE io NEW_LINE import BytesIO , IOBase NEW_LINE


import java . util . * ; import java . io . * ;   public class CFA { BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; private static final long MOD = 1000L * 1000L * 1000L + 7 ; private static final int [ ] dx = { 0 , - 1 , 0 , 1 } ; private static final int [ ] dy = { 1 , 0 , - 1 , 0 } ; private static final String yes = " Yes " ; private static final String no = " No " ;   void solve ( ) {


import java . util . * ;   public class Practise {   static int [ ] [ ] dp ;    public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int t = sc . nextInt ( ) ; while ( t > 0 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; boolean tt = true ; if ( b == a ) { System . out . println ( 0 ) ; tt = false ; } if ( b > a ) { long temp = a ; a = b ; b = temp ; } int c = 0 ; while ( a % 8 == 0 && ( a / 8 ) >= b ) {   a = a / 8 ; c ++ ; if ( a == b ) { System . out . println ( c ) ; tt = false ; break ; } } if ( tt ) { while ( a % 4 == 0 && ( a / 4 ) >= b ) {   a = a / 4 ; c ++ ; if ( a == b ) { System . out . println ( c ) ; tt = false ; break ; } }   } if ( tt ) { while ( a % 2 == 0 && ( a / 2 ) >= b ) {   a = a / 2 ; c ++ ; if ( a == b ) { System . out . println ( c ) ; tt = false ; break ; } } } if ( tt ) System . out . println ( - 1 ) ;                       t -- ; }    } }

import math     a = int ( input ( ) ) for i in range ( a ) : c , d = map ( int , input ( ) . split ( ) ) c , d = min ( c , d ) , max ( c , d ) num = 0 ; while ( c != d ) : if ( math . floor ( d / c ) == d // c and ( d // c ) % 8 == 0 ) : c *= 8 num += 1 elif ( math . floor ( d / c ) == d // c and d // c % 4 == 0 ) : c *= 4 num += 1 elif ( math . floor ( d / c ) == d // c and d // c % 2 == 0 ) : c *= 2 num += 1 else : num = - 1 break print ( num ) NEW_LINE


import sys   input = sys . stdin . buffer . readline   t = int ( input ( ) ) for _ in range ( t ) : a , b = map ( int , input ( ) . split ( ) ) a , b = max ( a , b ) , min ( a , b )   div , mod = divmod ( a , b ) if mod != 0 : print ( - 1 ) continue   count = 0   for factor in [ 8 , 4 , 2 ] : while div % factor == 0 : count += 1 div //= factor   print ( count if div == 1 else - 1 ) NEW_LINE


t = int ( input ( ) ) while t > 0 : digits = [ int ( i ) for i in input ( ) . split ( ) ] a = digits [ 0 ] b = digits [ 1 ] if a == b : print ( 0 ) else : if a < b : NEW_LINE


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


import java . util . Scanner ;   public class _0618JohnnyandAncientComputer {   public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int cases = sc . nextInt ( ) ; while ( cases > 0 ) { long a = sc . nextLong ( ) ; long b = sc . nextLong ( ) ; if ( a < b ) { long temp = a ; a = b ; b = temp ; } long val = a / b ; if ( a == b ) { System . out . println ( 0 ) ; } else if ( val % 2 != 0 || a % b != 0 ) { System . out . println ( - 1 ) ; } else { int count = 0 ; a : { while ( val > 1 ) { if ( val % 8 == 0 ) { count ++ ; val = val / 8 ; } else if ( val % 4 == 0 ) { val = val / 4 ; count ++ ; } else if ( val % 2 == 0 ) { val = val / 2 ; count ++ ; } else { break a ; } } } if ( val == 1 ) { System . out . println ( count ) ; } else { System . out . println ( - 1 ) ; } } cases -- ; } }   }


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ;   import java . util . * ; import javafx . util . Pair ;   public class Main { static long mod = ( long ) ( 1e9 + 7 ) ; public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; String s = input . next ( ) ; long ans = 0 ; long temp = 0 ; for ( int i = s . length ( ) - 1 ; i >= 0 ; i -- ) { if ( s . charAt ( i ) == ' b ' ) { temp ++ ; } else { ans += temp ; temp *= 2 ; ans = ans % mod ; temp = temp % mod ; } } System . out . println ( ans ) ; }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }

import math as mtimport sys , stringfrom collections import Counter , defaultdictinput = sys . stdin . readline MOD = 1000000007 PI = 3.14159265358979323 I = lambda : int ( input ( ) ) S = lambda : input ( ) M = lambda : map ( int , input ( ) . split ( ) ) Ms = lambda : map ( str , input ( ) . split ( ) ) ARR = lambda : list ( map ( int , input ( ) . split ( ) ) ) def solve ( ) : s = S ( ) ans , count_b = 0 , 0 for i in range ( len ( s ) - 1 , - 1 , - 1 ) : if s [ i ] == ' b ' : count_b += 1 else : ans += count_b ans %= MOD count_b *= 2 count_b %= MOD print ( ans )   tc = 1 NEW_LINE


import sys , os , iodef rs ( ) : return sys . stdin . readline ( ) . rstrip ( ) def ri ( ) : return int ( sys . stdin . readline ( ) ) def ria ( ) : return list ( map ( int , sys . stdin . readline ( ) . split ( ) ) ) def ws ( s ) : sys . stdout . write ( s + ' \n ' ) def wi ( n ) : sys . stdout . write ( str ( n ) + ' \n ' ) def wia ( a ) : sys . stdout . write ( ' ▁ ' . join ( [ str ( x ) for x in a ] ) + ' \n ' ) import math , datetime , functools , itertools , operator , bisect , fractions , statisticsfrom collections import deque , defaultdict , OrderedDict , Counterfrom fractions import Fractionfrom decimal import Decimalfrom sys import stdoutfrom heapq import heappush , heappop , heapify , _heapify_max , _heappop_max , nsmallest , nlargest NEW_LINE


a = input ( ) mod = 1000000007 ans = 0 count_a = 0 for i in a : if i == ' a ' : count_a += 1 else : ans += ( pow ( 2 , count_a , mod ) - 1 ) % modprint ( ans % mod ) NEW_LINE


MOD = int ( 1e9 ) + 7   def solve ( ) : s = input ( ) r = c = 0 for i in range ( len ( s ) - 1 , - 1 , - 1 ) : if s [ i ] == ' b ' : c += 1 else : r += c c = ( c * 2 ) % MOD   return r % MOD   print ( solve ( ) ) NEW_LINE


s = input ( ) a = 0 m = 10 ** 9 + 7 t = 0 for i in range ( len ( s ) ) : if s [ ~ i ] == ' a ' : a = ( a + t ) % m t = ( t * 2 ) % m else : t += 1 print ( a )   NEW_LINE


import java . lang . reflect . Array ; import java . text . CollationElementIterator ; import java . util . * ; import java . util . Map . Entry ; import java . io . * ; import java . lang . Math . * ; import java . math . BigInteger ;   import static java . lang . Math . * ; import static java . lang . System . * ; import static java . util . Arrays . fill ; import static java . util . Arrays . spliterator ; public class ContestMain implements Runnable { private static Reader in = new Reader ( ) ; private static StringBuilder ans = new StringBuilder ( ) ; private static long MOD = ( long ) ( 1e9 + 7 ) ; private static final int N = ( int ) ( 2e5 + 7 ) ;


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


import java . util . Scanner ;   public class Test10 { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int dishCount = sc . nextInt ( ) ; int desk = sc . nextInt ( ) ; int dishR = sc . nextInt ( ) ;   double angle = 360.0 / ( dishCount * 2 ) ; double minR = dishR / Math . sin ( Math . toRadians ( angle ) ) + dishR ;   if ( dishCount == 1 ) { if ( desk >= dishR ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } if ( dishCount == 2 ) { if ( 2 * dishR <= desk ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } }   if ( desk >= minR ) { System . out . println ( " YES " ) ; return ; } else { System . out . println ( " NO " ) ; return ; } } }

import math [ n , R , r ] = [ int ( x ) for x in input ( ) . split ( ) ]   m = Noneif r > R : m = 0 elif 2 * r > R : m = 1 elif 2 * r == R : m = 2 else : sina = r / ( R - r ) vysek = math . asin ( sina ) m = math . pi / vysek   if n <= m + 0.000000001 : print ( ' YES ' ) else : print ( ' NO ' ) NEW_LINE


import mathn , R , r = map ( int , input ( ) . split ( ) ) if r > R : print ( " NO " ) elif 2 * r > R and n == 1 : print ( " YES " ) elif 2 * r > R and n != 1 : print ( " NO " ) elif 2 * r <= R and n <= 2 : print ( " YES " ) else : d = math . asin ( r / ( R - r ) ) m = math . pi / d if abs ( round ( m ) - m ) < math . pow ( 10 , - 12 ) : m = round ( m ) else : m = math . floor ( m ) if m >= n : print ( " YES " ) else : print ( " NO " )   NEW_LINE


import math     def solve ( ) :   n , R , r = [ int ( x ) for x in input ( ) . split ( ' ▁ ' ) ] e = 10 ** ( - 7 )   if n == 1 : return r <= R elif n == 2 : return 2 * r <= R else : return r < ( R - r ) * math . sin ( math . pi / n ) + e     if solve ( ) : print ( " YES " ) else : print ( " NO " )   NEW_LINE


import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . StringTokenizer ;   public class Main { private static class InputReader { private BufferedReader br = null ; private StringTokenizer tokenizer = null ;   public InputReader ( InputStream is ) { super ( ) ; this . br = new BufferedReader ( new InputStreamReader ( is ) ) ; }   public String nextLine ( ) { try { return br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } }   public String next ( ) { for ( ; tokenizer == null || ! tokenizer . hasMoreTokens ( ) ; ) { tokenizer = new StringTokenizer ( nextLine ( ) ) ; } return tokenizer . nextToken ( ) ; }   public int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   public long nextLong ( ) { return Long . parseLong ( next ( ) ) ; }   public double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } }   public static void main ( String [ ] args ) { InputReader in = new InputReader ( System . in ) ;   int n = in . nextInt ( ) ; double R = in . nextDouble ( ) ; double r = in . nextDouble ( ) ; if ( n > 1 ) { if ( R >= r / Math . sin ( Math . toRadians ( 360.0 / n / 2 ) ) + r ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { if ( R >= r || n <= 0 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }


import java . util . Scanner ;   public class Test3 {   public static void main ( String [ ] args ) { int n ; double R , r ; double eps = 1e-10 ; double PI = Math . acos ( - 1 ) ; Scanner in = new Scanner ( System . in ) ; while ( in . hasNext ( ) ) { n = in . nextInt ( ) ; R = in . nextInt ( ) ; r = in . nextInt ( ) ; if ( n == 1 ) { if ( R >= r ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; continue ; } double tmp = Math . asin ( r / ( R - r ) ) ; if ( PI / tmp - n > - eps ) System . out . println ( " YES " ) ; else System . out . println ( " NO " ) ; }   } }


import java . util . Scanner ;   public class APeng { public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; double n = in . nextInt ( ) ; double R = in . nextInt ( ) ; double r = in . nextInt ( ) ; if ( R < r ) { System . out . println ( " NO " ) ; return ; } double cos = Math . sqrt ( Math . pow ( R , 2 ) - 2 * R * r ) / ( R - r ) ; if ( Math . PI / Math . acos ( cos ) >= n || n == 1 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }


import java . util . Scanner ;   public class Solution20200410 { public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; int n = scanner . nextInt ( ) ; double R = scanner . nextDouble ( ) ; double r = scanner . nextDouble ( ) ;   double angle = 360.0 / ( n * 2 ) ; double minR = r / Math . sin ( Math . toRadians ( angle ) ) + r ; if ( n == 1 ) { if ( R >= r ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else if ( n == 2 ) { if ( R >= r * 2 ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } else { if ( R >= minR ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } } }


import java . util . Scanner ;   public class Main { private static final Scanner in = new Scanner ( System . in ) ; public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int k1 = in . nextInt ( ) ; int [ ] s1 = genNums ( k1 ) ; int k2 = in . nextInt ( ) ; int [ ] s2 = genNums ( k2 ) ;   int [ ] result1 = new int [ n ] ; int [ ] result2 = new int [ n ] ;   for ( int i = 0 ; i < k1 ; i ++ ) { result1 [ n - s1 [ i ] ] = 1 ; } for ( int i = 0 ; i < k2 ; i ++ ) { result2 [ n - s2 [ i ] ] = 1 ; } result2 [ 0 ] = - 1 ; result1 [ 0 ] = - 1 ;   boolean changed = true ; while ( changed ) { changed = false ; for ( int i = n - 1 ; i > 0 ; i -- ) {   changed = stateChanged ( n , k1 , s1 , result1 , result2 , changed , i ) ;   changed = stateChanged ( n , k2 , s2 , result2 , result1 , changed , i ) ; } }   printRound ( n , result1 ) ; System . out . println ( ) ; printRound ( n , result2 ) ; }

f = lambda : list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] n = int ( input ( ) ) s , p , q = [ ] , [ ] , [ ] for x in [ 0 , 1 ] : r = f ( ) s . append ( r ) t = [ len ( r ) ] * n t [ 0 ] = 0 p . append ( t ) q . append ( ( x , 0 ) ) while q : x , i = q . pop ( ) y = 1 - x for d in s [ y ] : j = ( i - d ) % n if p [ y ] [ j ] < 1 : continue p [ y ] [ j ] = - 1 for d in s [ x ] : k = ( j - d ) % n if p [ x ] [ k ] < 1 : continue p [ x ] [ k ] -= 1 if p [ x ] [ k ] == 0 : q . append ( ( x , k ) ) for x in [ 0 , 1 ] : print ( * [ [ ' Lose ' , ' Loop ' , ' Win ' ] [ min ( q , 1 ) ] for q in p [ x ] [ 1 : ] ] ) NEW_LINE


class T : h = ( ' Lose ' , ' Loop ' , ' Win ' ) def __init__ ( t ) : t . s = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] t . p = [ len ( t . s ) ] * n t . p [ 0 ] = 0 def f ( t , i ) : for d in t . s : j = ( i - d ) % n if t . p [ j ] > 0 : yield j def g ( t ) : print ( * [ t . h [ min ( q , 1 ) ] for q in t . p [ 1 : ] ] ) n = int ( input ( ) ) r , m = T ( ) , T ( ) q = [ ( r , m , 0 ) , ( m , r , 0 ) ] while q : x , y , i = q . pop ( ) for j in y . f ( i ) : y . p [ j ] = - 1 for k in x . f ( j ) : x . p [ k ] -= 1 if not x . p [ k ] : q . append ( ( x , y , k ) ) r . g ( ) m . g ( ) NEW_LINE


RESULT = [ ' Lose ' , ' Loop ' , ' Win ' ]   class Player ( object ) : """ docstring ▁ for ▁ Player """ def __init__ ( self ) : super ( Player , self ) . __init__ ( ) self . a = list ( map ( int , input ( ) . split ( ) ) ) [ 1 : ] self . f = [ len ( self . a ) ] * n self . f [ 0 ] = 0   def prev ( self , i ) : for x in self . a : if self . f [ ( i - x ) % n ] > 0 : yield ( i - x ) % n   def print_result ( self ) : print ( * [ RESULT [ min ( x , 1 ) ] for x in self . f [ 1 : ] ] )   n = int ( input ( ) ) a , b = Player ( ) , Player ( ) q = [ ( a , b , 0 ) , ( b , a , 0 ) ] while q : x , y , i = q . pop ( ) for j in y . prev ( i ) : y . f [ j ] = - 1 for k in x . prev ( j ) : x . f [ k ] -= 1 if x . f [ k ] == 0 : q . append ( ( x , y , k ) )   a . print_result ( ) b . print_result ( ) NEW_LINE


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

n = int ( input ( ) ) al = [ ] bl = [ ] for i in range ( n ) : a , b = [ int ( x ) for x in input ( ) . split ( ) ] al . append ( a ) bl . append ( b ) count = 0 for i , bot in enumerate ( al ) : if bot in bl [ : i ] + bl [ i + 1 : ] : count += 1   print ( n - count ) NEW_LINE


n = int ( input ( ) ) a = [ ] b = [ ] cnt = 0 carry = dict ( ) for i in range ( n ) : ai , bi = [ int ( x ) for x in input ( ) . split ( ) ] a . append ( ai ) b . append ( bi ) if bi in carry . keys ( ) : carry [ bi ] += 1 else : carry [ bi ] = 1 for i in range ( n ) : carry [ b [ i ] ] -= 1 if ( a [ i ] not in carry . keys ( ) or carry [ a [ i ] ] == 0 ) : cnt += 1 carry [ b [ i ] ] += 1 print ( cnt ) NEW_LINE


n = int ( input ( ) ) count = 0 a = [ ] b = [ ] for i in range ( n ) : x , y = map ( int , input ( ) . split ( ) ) a . append ( x ) b . append ( y ) v = b . copy ( ) for i in range ( n ) : del v [ i ] if not a [ i ] in v : count += 1 v = b . copy ( ) print ( count ) NEW_LINE


n = int ( input ( ) ) nn = nnnn = nb = [ ] o = [ ] c = 0 while n > 0 : n -= 1 bt , ot = map ( int , input ( ) . split ( ) ) b . append ( bt ) o . append ( ot ) for i in range ( 0 , nnn ) : if b [ i ] == o [ i ] and o . count ( o [ i ] ) == 1 : nn += 1 o = set ( o ) for i in o : temp = b . count ( i ) nn -= temp   print ( nn ) NEW_LINE


from collections import defaultdictn = int ( input ( ) ) l = [ ] d = defaultdict ( int ) ans = 0 for i in range ( n ) : a , b = map ( int , input ( ) . split ( ) ) l . append ( [ a , b ] ) d [ b ] += 1 for i in range ( n ) : if l [ i ] [ 1 ] == l [ i ] [ 0 ] and d [ l [ i ] [ 1 ] ] == 1 or l [ i ] [ 0 ] not in d : ans += 1 print ( ans ) NEW_LINE


import java . util . ArrayList ; import java . util . Scanner ;   public class BottleOpener { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ;   int n = scan . nextInt ( ) ; int [ ] open = new int [ 1000 ] ; ArrayList < Integer > same = new ArrayList < > ( ) ;   for ( int i = 0 ; i < n ; i ++ ) { int a = scan . nextInt ( ) ; int b = scan . nextInt ( ) ;   if ( same . contains ( a ) ) { open [ b - 1 ] += 1000 ; open [ a - 1 ] -- ; }   if ( a == b ) { if ( ! same . contains ( b ) ) { same . add ( b ) ; if ( open [ a - 1 ] % 1000 > 0 ) { open [ a - 1 ] -= open [ a - 1 ] % 1000 ; } } } else open [ b - 1 ] += 1000 ;   open [ a - 1 ] ++ ; }   int countC = 0 ; for ( int i = 0 ; i < 1000 ; i ++ ) { if ( open [ i ] > 0 && open [ i ] < 1000 ) countC += open [ i ] ; } System . out . println ( countC ) ; } }


import java . io . OutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . PrintWriter ; import java . util . * ; import java . io . IOException ; import java . io . BufferedReader ; import java . io . InputStreamReader ; import java . io . InputStream ;   import static java . lang . Math . log ; import static java . lang . Math . min ;   public class First {   public static void main ( String [ ] args ) { InputStream inputStream = System . in ; OutputStream outputStream = System . out ; InputReader in = new InputReader ( inputStream ) ; PrintWriter out = new PrintWriter ( outputStream ) ; TaskA solver = new TaskA ( ) ; int t ;


import java . util . Scanner ;   public class Main {   public static void main ( String [ ] args ) {   Scanner sc = new Scanner ( System . in ) ;   int n = sc . nextInt ( ) ;   int arr1 [ ] = new int [ n ] ; int arr2 [ ] = new int [ n ] ;   int ans = n ;   for ( int i = 0 ; i < n ; i ++ ) {   arr1 [ i ] = sc . nextInt ( ) ; arr2 [ i ] = sc . nextInt ( ) ;   }   int b = - 5 ;   for ( int i = 0 ; i < n ; i ++ ) {   for ( int j = 0 ; j < n ; j ++ ) {   if ( arr1 [ i ] == arr2 [ j ] && i != j ) { ans -- ; break ; }   }   }   System . out . println ( ans ) ;   }   }


import java . io . * ; import java . util . * ; 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 ) throws Exception { FastReader sc = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ;

n = int ( input ( ) ) arr = list ( map ( int , input ( ) . split ( ) ) ) for i in range ( n ) : arr [ i ] -= i arr [ i ] = [ arr [ i ] , i ] arr . sort ( ) ma = 0 s = arr [ 0 ] [ 0 ] + arr [ 0 ] [ 1 ] for i in range ( 1 , n ) : if ( arr [ i - 1 ] [ 0 ] != arr [ i ] [ 0 ] ) : ma = max ( s , ma ) s = arr [ i ] [ 0 ] + arr [ i ] [ 1 ] else : s += arr [ i ] [ 0 ] + arr [ i ] [ 1 ] ma = max ( ma , s ) print ( ma ) NEW_LINE


import sysn = int ( sys . stdin . readline ( ) ) l = list ( map ( int , sys . stdin . readline ( ) . split ( ) ) )   val = [ 0 for i in range ( 800010 ) ] for i in range ( n ) : val [ ( i + 1 ) - l [ i ] + 400000 ] += l [ i ] print ( max ( val ) ) NEW_LINE


from math import * from sys import stdininput = stdin . readlinen , i = int ( input ( ) ) , 0 d = { } for x in list ( map ( int , input ( ) . split ( ) ) ) : d [ x - i ] = d . get ( x - i , 0 ) + x i += 1 print ( max ( d . values ( ) ) ) NEW_LINE


n = int ( input ( ) ) b = list ( map ( int , input ( ) . split ( ) ) ) l = [ [ ] for i in range ( 10 ** 6 ) ] d = [ b [ i ] - ( i + 1 ) for i in range ( n ) ] for i in range ( n ) : l [ d [ i ] ] . append ( b [ i ] ) ans = - 1 for i in range ( len ( l ) ) : if l [ i ] : ans = max ( ans , sum ( l [ i ] ) ) print ( ans ) NEW_LINE


import sysinput = sys . stdin . readline   n = int ( input ( ) ) b = [ int ( x ) for x in input ( ) . split ( ) ] c = [ 0 ] * ( 10 ** 6 ) for i in range ( n ) : c [ b [ i ] - i ] += b [ i ]   print ( max ( c ) ) NEW_LINE


import java . util . * ; import java . io . * ; import java . math . * ;   public class First { public static void process ( ) throws IOException { int n = ni ( ) ; int a [ ] = new int [ n + 1 ] ; int b [ ] = new int [ n + 1 ] ; HashMap < Integer , Long > map = new HashMap < Integer , Long > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { a [ i ] = ni ( ) ; b [ i ] = i - a [ i ] ; } long ans = 1l ; for ( int i = 1 ; i <= n ; i ++ ) { if ( map . isEmpty ( ) || ! map . containsKey ( b [ i ] ) ) { long x = a [ i ] ; map . put ( b [ i ] , x ) ; ans = Math . max ( ans , x ) ; } else { long x = map . get ( b [ i ] ) ; x += a [ i ] ; ans = Math . max ( ans , x ) ; map . put ( b [ i ] , x ) ; } } pn ( ans ) ;     }     static AnotherReader sc ; static PrintWriter out ; public static void main ( String [ ] args ) throws IOException { out = new PrintWriter ( System . out ) ; sc = new AnotherReader ( ) ; boolean oj = true ;


import java . lang . * ; import java . util . * ; import java . util . stream . Collectors ; import java . io . * ;   public class Expedition { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int [ ] ar = new int [ n + 1 ] ; Map < Integer , Long > map = new HashMap < Integer , Long > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { ar [ i ] = sc . nextInt ( ) ; int key = i - ar [ i ] ; if ( map . containsKey ( key ) ) { map . replace ( key , map . get ( key ) + ar [ i ] ) ; } else map . put ( key , ( long ) ar [ i ] ) ; } long max = 0 ; for ( Map . Entry < Integer , Long > entry : map . entrySet ( ) ) { max = Math . max ( max , entry . getValue ( ) ) ; } System . out . println ( ( long ) max ) ; } }


import java . io . BufferedReader ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . math . BigInteger ; import java . util . * ;   import javafx . util . Pair ;   public class Main {   public static void main ( String args [ ] ) { FastScanner input = new FastScanner ( ) ; int n = input . nextInt ( ) ; HashMap < Long , Long > map = new HashMap < > ( ) ; long a [ ] = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = input . nextLong ( ) ; map . put ( i - a [ i ] , map . getOrDefault ( i - a [ i ] , 0L ) + a [ i ] ) ; } Long ans = Long . MIN_VALUE ; for ( Map . Entry < Long , Long > entry : map . entrySet ( ) ) { Long key = entry . getKey ( ) ; Long value = entry . getValue ( ) ; ans = Math . max ( ans , value ) ; } System . out . println ( ans ) ;   }   static class FastScanner {   BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer st = new StringTokenizer ( " " ) ;   String next ( ) { while ( ! st . hasMoreTokens ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; }   int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; }   long nextLong ( ) {   return Long . parseLong ( next ( ) ) ; }   double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; }   String nextLine ( ) throws IOException { return br . readLine ( ) ; } }   }


import java . math . BigInteger ; import java . util . Scanner ;    public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; BigInteger b = BigInteger . valueOf ( sc . nextLong ( ) ) ; if ( b . mod ( BigInteger . valueOf ( 10 ) ) . compareTo ( ( BigInteger . valueOf ( 5 ) ) ) < 0 ) b = b . subtract ( b . mod ( BigInteger . valueOf ( 10 ) ) ) ; if ( b . mod ( BigInteger . valueOf ( 10 ) ) . compareTo ( ( BigInteger . valueOf ( 5 ) ) ) >= 0 ) b = b . add ( BigInteger . valueOf ( 10 ) . subtract ( b . mod ( BigInteger . valueOf ( 10 ) ) ) ) ; System . out . println ( b ) ; } }

n = int ( input ( ) ) num_to_rem = n % 10 if num_to_rem >= 5 : print ( n - num_to_rem + 10 ) else : print ( n - num_to_rem ) NEW_LINE


n = input ( ) if n [ - 1 ] == '0' : print ( n ) elif n [ - 1 ] <= '5' : s = int ( n [ - 1 ] ) n = int ( n ) print ( n - s ) else : s = 10 - int ( n [ - 1 ] ) print ( int ( n ) + s )   NEW_LINE


try : n = int ( input ( ) ) if ( n % 10 < 6 ) : print ( n - n % 10 ) else : print ( n + ( 10 - n % 10 ) ) except : pass NEW_LINE


n = input ( ) num = int ( n ) x = list ( map ( int , n . strip ( ) ) ) y = list ( n . strip ( ) )     if len ( x ) == 1 and x != "5" : if x [ 0 ] > 5 : print ( 10 ) else : print ( 0 ) else : if int ( x [ - 1 ] ) < 5 : y [ - 1 ] = "0" print ( ' ' . join ( y ) )   else :   while ( n [ - 1 ] != "0" ) : num = num + 1 n = str ( num ) if n [ - 1 ] == "0" : print ( num ) NEW_LINE


n = int ( input ( ) ) if n % 10 == 0 : print ( n ) elif n % 10 <= 5 : print ( n - ( n % 10 ) ) else : print ( n + ( 10 - ( n % 10 ) ) ) NEW_LINE


import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; System . out . println ( ( scan . nextLong ( ) + 5 ) / 10 * 10 ) ; } }


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; System . out . println ( ( n % 10 < 5 ) ? n / 10 * 10 : ( n / 10 + 1 ) * 10 ) ; } }


import java . util . * ;   public class Test { public static void main ( String [ ] args ) {   Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int t = n % 10 ; System . out . println ( ( t >= 5 ) ? n + ( 10 - t ) : n - t ) ; } }


import java . util . Scanner ;   public class Main { public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int num = sc . nextInt ( ) ; if ( num % 10 <= 5 ) num -= num % 10 ; else num += 10 - num % 10 ; System . out . println ( num ) ; } }


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

class Heap : def __init__ ( self , * data ) : self . arr = [ ] self . size = 0 if not data : return else : for item in data : self . insert ( item )   def __str__ ( self ) : return str ( self . arr )   def sift_up ( self , index ) : while index : parent = ( index - 1 ) // 2 if self . arr [ index ] < self . arr [ parent ] : self . arr [ index ] , self . arr [ parent ] = self . arr [ parent ] , self . arr [ index ] index = parent else : break   def sift_down ( self ) : if not self . size : return   index = 0 child_left = index * 2 + 1   while child_left < self . size : child_right = index * 2 + 2   if child_right >= self . size or self . arr [ child_left ] <= self . arr [ child_right ] : branch = child_left else : branch = child_right   if self . arr [ index ] < self . arr [ branch ] : return   self . arr [ index ] , self . arr [ branch ] = self . arr [ branch ] , self . arr [ index ] index = branch child_left = index * 2 + 1   def insert ( self , data ) : self . arr . append ( data ) self . size += 1 self . sift_up ( self . size - 1 )   def pop_min ( self ) : if not self . size : return self . arr [ 0 ] , self . arr [ - 1 ] = self . arr [ - 1 ] , self . arr [ 0 ] self . size -= 1 self . sift_down ( ) return self . arr . pop ( )     def heap_sort ( arr : list ) : heap = Heap ( * arr ) for i in range ( heap . size ) : arr [ i ] = heap . pop_min ( )     n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) )   heap_sort ( a )   ans = 0 for i in range ( 1 , len ( a ) , 2 ) : ans += a [ i ] - a [ i - 1 ]   print ( ans ) NEW_LINE


num = int ( input ( ) ) li = list ( map ( int , input ( ) . split ( ) ) ) li . sort ( ) a = 0 for i in range ( 0 , num , 2 ) : a += abs ( li [ i ] - li [ i + 1 ] ) print ( a ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) print ( sum ( a [ 1 : : 2 ] ) - sum ( a [ 0 : : 2 ] ) ) NEW_LINE


n = int ( input ( ) ) a = list ( map ( int , input ( ) . split ( ) ) ) a . sort ( ) c = 0 for i in range ( 1 , n , 2 ) : if a [ i - 1 ] != a [ i ] : c += ( a [ i ] - a [ i - 1 ] ) print ( c ) 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 ) 1e9 ;   public static void solve ( ) throws Exception { int n = f . ni ( ) ; int arr [ ] = new int [ n ] ;   for ( int i = 0 ; i < n ; ++ i ) arr [ i ] = f . ni ( ) ;   sort ( arr ) ; int ans = 0 ; for ( int i = 0 ; i + 1 < n ; i += 2 ) { ans += arr [ i + 1 ] - arr [ i ] ; } pn ( ans ) ; } public static void main ( String [ ] args ) throws Exception { if ( memory ) new Thread ( null , new Runnable ( ) { public void run ( ) { try { new Main ( ) . run ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } } , " " , 1 << 28 ) . start ( ) ; else new Main ( ) . run ( ) ; } void run ( ) throws Exception { if ( System . getProperty ( " ONLINE _ JUDGE " ) == null ) { f = new FastScanner ( " " ) ; pw = new PrintWriter ( System . out ) ; } else { f = new FastScanner ( ) ; pw = new PrintWriter ( System . out ) ;


import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . util . Arrays ; import java . util . StringTokenizer ;   public class temp4 { 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 Print { private final BufferedWriter bw ; public Print ( ) { bw = new BufferedWriter ( new OutputStreamWriter ( System . out ) ) ; } public void print ( String str ) throws IOException { bw . append ( str ) ; } public void println ( String str ) throws IOException { print ( str ) ; bw . append ( " \n " ) ; } public void close ( ) throws IOException { bw . close ( ) ; } } public static void main ( String [ ] args ) throws IOException { FastReader scn = new FastReader ( ) ; Print pr = new Print ( ) ; int n = scn . nextInt ( ) ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = scn . nextInt ( ) ; } Arrays . sort ( arr ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i += 2 ) { ans += arr [ i + 1 ] - arr [ i ] ; } System . out . println ( ans ) ; } }


import java . util . * ; import java . io . * ; public class B { public static void taskSolver ( FastReader sc ) { int n = sc . nextInt ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = sc . nextInt ( ) ; int ans = 0 ; Arrays . sort ( arr ) ; for ( int i = 1 ; i <= n ; i += 2 ) { ans += Math . abs ( arr [ i ] - arr [ i - 1 ] ) ; } System . out . println ( ans ) ; } public static void main ( String args [ ] ) { FastReader sc = new FastReader ( ) ; taskSolver ( sc ) ; } public static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static class FastReader { BufferedReader br ; StringTokenizer st ; public FastReader ( ) { br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; } String next ( ) { while ( st == null || ! st . hasMoreElements ( ) ) { try { st = new StringTokenizer ( br . readLine ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return st . nextToken ( ) ; } int nextInt ( ) { return Integer . parseInt ( next ( ) ) ; } long nextLong ( ) { return Long . parseLong ( next ( ) ) ; } double nextDouble ( ) { return Double . parseDouble ( next ( ) ) ; } String nextLine ( ) { String str = " " ; try { str = br . readLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return str ; } } }


import java . util . * ; public class MyClass { 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 ( ) ; Arrays . sort ( arr ) ; long s = 0 ; for ( int i = 0 ; i < n ; i += 2 ) { s = s + arr [ i + 1 ] - arr [ i ] ; } System . out . println ( s ) ; } }


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

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


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


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


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


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


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


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


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


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

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


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


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


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


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


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


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


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


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

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


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


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


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


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


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


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


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

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


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


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


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


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


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

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


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


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


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


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


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

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


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


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


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


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


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


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


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

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


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


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


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


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


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


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

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


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


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


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

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


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


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


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


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


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


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

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


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


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


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


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


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


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


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

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


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


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


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


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


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


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

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


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


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


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


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