Problem:
Score : 100 points

Problem Statement

You are given two integers A and B as the input. Output the value of A + B.

However, if A + B is 10 or greater, output error instead.

Constraints

A and B are integers.

1 ≤ A, B ≤ 9

Input

Input is given from Standard Input in the following format:

A B

Output

If A + B is 10 or greater, print the string error (case-sensitive); otherwise, print the value of A + B.

Sample Input 1

6 3

Sample Output 1

9

Sample Input 2

6 4

Sample Output 2

error

Solution in Scala (2.11.7) (judge verdict: Runtime Error)

import scala.io.Source

object Main {

  def main(args: Array[String]) {
    val lines = Source.stdin.getLines.toSeq
    val arr = lines.head.split(" ")
    val n = arr(0).toLong
    val a = arr(1).toLong
    val b = arr(2).toLong
    val hs = lines.tail.map(_.toLong)

    def isSat(xs: Seq[Long], count: Long): Boolean =
      if (count < 0) false
      else xs match {
        case Nil => true
        case x +: rest => isSat(rest, count - ((x - 1) / (a - b) + 1))
      }

    def minimize(lower: Long, upper: Long): Long =
      if (lower >= upper) upper
      else {
        val k = (lower + upper) / 2
        val hs2 = hs.map(_ - b * k).filter(_ > 0)
        if (isSat(hs2, k)) minimize(lower, k)
        else minimize(k + 1, upper)
      }

    val lowerBound = hs.max / a
    val upperBound = hs.max / b
    println(minimize(lowerBound, upperBound))
  }

}