import kotlin.coroutines.experimental.buildSequence val D = "1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991" inline fun add1(e: Int, c: Int): Int = e+c inline fun add2(e: Pair, c: Int): Int = e.first+e.second+c fun f(s: String): Sequence { fun f(n: Int): Sequence = buildSequence { for (i in (D.length-1) downTo 0) yield(n * D.slice(i..i).toInt()) } fun g(m: Int, n: Int): Sequence> = buildSequence { yield(0); yieldAll(f(m)) //; yield(0) }.zip(buildSequence { yieldAll(f(n)); yield(0) //; yield(0) }) tailrec fun iter(c: Int, sq: Sequence, add: (T, Int) -> Int): Sequence = buildSequence { val e = sq.firstOrNull() if (e!=null) { yield(add(e,c)%10); yieldAll(iter(add(e,c)/10, sq.drop(1), add)) } else { if (c!=0) { yield(c) } } } return ( if (s.length==1) iter(0, f(s.toInt()), ::add1) else iter(0, g(s.slice(0..0).toInt(),s.slice(1..1).toInt()), ::add2) ) } fun fmt(s: String) = if (s.length!=D.length) s.slice(0..s.length-D.length-1)+"."+s.slice(s.length-D.length..s.length-1) else "0."+s fun main(args: Array) { val s = readLine()!! println( if (s=="100") D.slice(0..1)+"."+D.slice(2..D.length-1) else fmt(f(s).fold("", fun (a,e) = e.toString()+a)) ) }