object Solution { def canConstruct(a: Array[Int]): String = { // Return "Yes" or "No" denoting whether you can construct the required number. val concat = a.mkString("") var total = 0 concat.foreach { i => total += (i.toInt) } if (total % 3 == 0) "Yes" else "No" } def main(args: Array[String]) { val sc = new java.util.Scanner (System.in); var t = sc.nextInt(); var a0 = 0; while(a0 < t){ var n = sc.nextInt(); var a = new Array[Int](n); for(a_i <- 0 to n-1) { a(a_i) = sc.nextInt(); } val result = canConstruct(a); println(result) a0+=1; } } }