package Ġgc j . y 2 0 2 0 . kick start _ b Ċ Ċ private Ġfun Ġsolve (): ĠLong Ġ{ Ċ ĉ val Ġd Init Ġ= Ġread Long s ()[ 1 ] Ċ ĉ return Ġread Long s (). fold Right ( d Init ) Ġ{ Ġx , Ġd Ġ-> Ġd Ġ- Ġd Ġ% Ġx ĉ } Ċ } Ċ Ċ fun Ġmain () Ġ= Ġrepeat ( readInt ()) Ġ{ Ġprintln (" Case Ġ# ${ it Ġ+ Ġ 1 }: Ġ${ solve () }") Ġ} Ċ Ċ private Ġfun Ġread Ln () Ġ= Ġread Line () !! Ċ private Ġfun Ġread Int () Ġ= Ġread Ln (). toInt () Ċ private Ġfun Ġread Strings () Ġ= Ġread Ln (). split (" Ġ") Ċ private Ġfun Ġread Long s () Ġ= Ġread Strings (). map Ġ{ Ġit . to Long () Ġ} Ċ