import java.util.*

data class Box(val a: Int = 0, val b: Int = 0) : Comparable<Box> {
    override fun compareTo(other: Box): Int {
        return this.b - other.b
    }
}

fun main(args: Array<String>) {
    var (n, m) = readLine()!!.split(' ').map {it.toInt()}
    val x = Array(m) {Box()}
    for (i in 0 until m) {
        val line = readLine()!!.split(' ').map {it.toInt()}
        x[i] = Box(line[0], line[1])
    }

    var sum = 0
    for (box in x.sortedDescending()) {
        val take = minOf(box.a, n)
        n -= take
        sum += take * box.b
    }
    println(sum)
}

import java.util.*

fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    val n = reader.nextInt()
    val m = reader.nextInt()

    val list = mutableListOf<Pair<Int, Int>>()
    (1..m).forEach {
        val a = reader.nextInt()
        val b = reader.nextInt()
        list.add(Pair(a, b))
    }

    var matchBoxesLeft = n
    var matches = 0
    list.sortedByDescending { it.second }.map {
        if (matchBoxesLeft <= 0)
            return@map

        matchBoxesLeft -= it.first
        if (matchBoxesLeft >= 0) {
            matches += it.first * it.second
        } else {
            matchBoxesLeft += it.first
            matches += (matchBoxesLeft) * it.second
            matchBoxesLeft -= it.first
        }
    }
    print(matches)
}

// n == 7 && a = 5
//
//      matcheBoxLeft = n - a

import java.util.Comparator

//import kotlin.math.abs

fun main(args: Array<String>) {

    var (n, m) = readLine()!!.split(' ').map(String::toLong)

    var pairs = arrayListOf<Pair>();
    for (elem in 1..m) {
        var (i, j) = readLine()!!.split(' ').map(String::toLong);

        pairs.add(Pair(i, j));
    }

    pairs.sortWith(Comparator { a, b -> if (a.y > b.y) -1 else 1 });

    var count = 0L;

    var i = 0;
    while (n > 0 && i < m) {
        if (pairs[i].x > n) {
            count += n * pairs[i].y
            n = 0;
        } else {
            n -= pairs[i].x;
            count += pairs[i].x * pairs[i].y
        }

        i++;
    }

    print(count)

}

class Pair(x: Long, y: Long) {
    var x: Long = x;
    var y: Long = y;
}

fun calculateBoxes(): Int {
    val map = sortedMapOf<Int, Int>()

    fun readPairOfIntegers() = readLine()!!.split(" ").let { Pair(it[0].toInt(), it[1].toInt()) }

    fun addToMap(key: Int, value: Int) {
        fun getValue(key: Int): Int {
            if (map[key] == null) {
                map[key] = 0
            }
            return map[key]!!
        }
        map[key] = value + getValue(key)
    }
    var matchesTaken = 0
    var (availableCapacity, containersCount) = readPairOfIntegers()
    repeat(containersCount) {
        val (boxesCount, boxCapacity) = readPairOfIntegers()
        addToMap(-boxCapacity, boxesCount)
    }
    map.entries.forEach { (boxCapacityNegative, boxesCount) ->
        val boxCapacity = -boxCapacityNegative
        if (boxesCount >= availableCapacity) {
            matchesTaken += availableCapacity * boxCapacity
            return matchesTaken
        } else {
            matchesTaken += boxesCount * boxCapacity
            availableCapacity -= boxesCount
        }
    }
    return matchesTaken
}

fun main() = println(calculateBoxes())

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.io.Reader
import java.util.*

fun main(args: Array<String>) {
    val reader = Reader()
    var capacity = reader.nextInt()
    val n = reader.nextInt()
    val list = mutableListOf<Pair<Int, Int>>()
    var total = 0
    for (i in 0 until n) {
        val numberOfBoxes = reader.nextInt()
        val numberOfmMatches = reader.nextInt()
        list.add(numberOfBoxes to numberOfmMatches)
    }
    list.sortBy { it.second }
    for (i in n-1 downTo 0) {
        total += if (capacity >= list[i].first)
            list[i].first * list[i].second
        else
            capacity * list[i].second
        capacity -= list[i].first
        if (capacity <= 0)
            break
    }
    println(total)
}

internal class Reader {
    var br: BufferedReader
    var st: StringTokenizer? = null

    init {
        br = BufferedReader(InputStreamReader(System.`in`))
    }

    operator fun next(): String {
        while (st == null || !st!!.hasMoreElements()) {
            try {
                st = StringTokenizer(br.readLine())
            } catch (e: IOException) {
                e.printStackTrace()
            }

        }
        return st!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }

    fun nextLine(): String {
        var str = ""
        try {
            str = br.readLine()
        } catch (e: IOException) {
            e.printStackTrace()
        }

        return str
    }
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val (n, m) = br.readLine().split(" ").map { it.toInt() }
    val matches = List(m){br.readLine().split(" ").map { it.toInt() }}
        .sortedByDescending { it[1] }
    var cnt = 0
    var takenBoxes = 0
    var i = 0
    var full = false
    while (i < m && !full) {
        val (a, b) = matches[i]
        if (takenBoxes + a <= n) {
            cnt += a*b
            takenBoxes += a
            i++
        } else {
            cnt += (n - takenBoxes)*b
            full = true
        }
    }
    println(cnt)
}

import java.util.*

fun main() {
    val reader = Scanner(System.`in`)
    var noToHold = reader.nextInt()
    val containersLength = reader.nextInt()
    val containers = mutableListOf<Pair<Int,Int>>()
    for (i in 1..containersLength) {
        val key = reader.nextInt()
        val value = reader.nextInt()
        containers.add(Pair(key,value))
    }
    val sortedContainers = containers.toList()
            .sortedByDescending { (key, value) -> value }
    var total = 0
    for (container in sortedContainers) {
        if (noToHold != 0) {
            if (container.first <= noToHold) {
                noToHold -= container.first
                total += container.first * container.second
            } else {
                total += noToHold * container.second
                noToHold -= noToHold
            }
        }
        else
            break
    }
    print(total)
}

fun main(args: Array<String>) {
    var (n, m) = readLine()!!.split(" ").map(String::toInt)
    val sibice : MutableList<Par<Int,Int>> = MutableList(m) { Par(0,0) }
    for(i in 0 until m) {
        val (f, s) = readLine()!!.split(" ").map(String::toInt)
        sibice[i] = Par(f,s)
    }
    sibice.sortBy { -it.second }
    var sum = 0L
    while(n > 0 && !sibice.isEmpty()) {
        if(n - sibice[0].first > 0) {
            n -= sibice[0].first
            sum += (sibice[0].second * sibice[0].first)
            sibice.removeAt(0)
        } else {
            sum += n * sibice[0].second
            break
        }
    }
    println(sum)
}

class Par<T1, T2> constructor(var first : T1, var second : T2)

import kotlin.math.min

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    var (numMatchBoxes, numContainers) = readInts()
    val options = Array(numContainers) { 0 to 0 }
    for (container in 0 until numContainers) {
        val (numBoxes, numMatches) = readInts()
        options[container] = numMatches to numBoxes
    }
    options.sortByDescending { it.first }
    var sol = 0L
    for (option in options) {
        val numBoxes = min(numMatchBoxes, option.second)
        sol += numBoxes * option.first
        numMatchBoxes -= numBoxes
        if (numMatchBoxes == 0) break
    }
    print(sol)
}

import java.util.*

fun main() {
    val reader = Scanner(System.`in`)
    var noToHold = reader.nextInt()
    val containersLength = reader.nextInt()
    val containers = mutableMapOf<Int, Int>()
    for (i in 1..containersLength) {
        containers.put(reader.nextInt(), reader.nextInt())
    }
    val sortedContainers = containers.toList()
            .sortedByDescending { (key, value) -> value }
            .toMap()
    var total = 0
    for (container in sortedContainers) {
        if (noToHold != 0) {
            if (container.key <= noToHold) {
                noToHold -= container.key
                total += container.key * container.value
            } else {
                total += noToHold * container.value
                noToHold -= noToHold
            }
        }
        else
            break
    }
    print(total)
}

fun main(args: Array<String>) {
    var (n, m) = readLine()!!.split(" ").map(String::toLong)
    val sibice : MutableList<Par<Long,Long>> = MutableList(0) { Par(0L,0L) }
    for(i in 0 until m) {
        val (f, s) = readLine()!!.split(" ").map(String::toLong)
        sibice.add(Par(f, s))
    }

    sibice.sortBy { -it.second }

    var sum = 0L
    var i = 0
    while(n > 0) {
        if(sibice[i].first > 0) {
            sum += sibice[i].second
            sibice[i].first--
            n--
        } else {
            sibice.removeAt(i)
            if(sibice.isEmpty()) break
            else i++
        }
    }

    println(sum)
}

class Par<T1, T2> constructor(var first : T1, var second : T2)


import kotlin.math.max
import kotlin.math.min

fun main() {
    fun readLongs() = readLine()!!.split(" ").map(String::toLong)

    val (l1, r1, l2, r2, k) = readLongs()
    val start = max(l1, l2)
    val end = min(r1, r2)
    if (end < start) return print(0)
    print(end - start + 1 - if (k in start..end) 1 else 0)
}

fun main(vararg args: String) {
    val (l1, r1, l2, r2, k) = readLine()!!.split(' ').map { it.toLong() }
    val l = Math.max(l1, l2)
    val r = Math.min(r1, r2)
    if (l > r) {
        println(0)
    } else {
        var o = r - l + 1
        if (k in l..r) o -= 1
        println(o)
    }
}

import java.io.BufferedReader
import java.io.InputStreamReader
import java.math.BigInteger

fun main(vararg params: String) {
    val br = BufferedReader(InputStreamReader(System.`in`))

    val inputs = br.readLine().split(" ").take(5).map { BigInteger(it) }

    val l1 = inputs[0]
    val r1 = inputs[1]
    val l2 = inputs[2]
    val r2 = inputs[3]
    val k = inputs[4]

    val lowLimit = l1.max(l2)
    val highLimit = r1.min(r2)
    val minutes = highLimit - lowLimit + BigInteger.ONE
    if (minutes <= BigInteger.ZERO)
        println(0)
    else
        if (k <= highLimit && k >= lowLimit) println(minutes - BigInteger.ONE) else println(minutes)
}

import java.io.BufferedReader
import java.io.File
import java.io.PrintWriter

fun main(args: Array<String>) {
    val onlineJudge = System.getProperty("ONLINE_JUDGE") == "true"
    val input = if (onlineJudge) System.`in`.bufferedReader() else File("input.txt").bufferedReader()
    val output = if (onlineJudge) PrintWriter(System.out.writer(), true) else PrintWriter(File("output.txt"))

    solve(input, output)

    output.flush()
    output.close()
}

private fun solve(input: BufferedReader, output: PrintWriter) {
    val (l1, r1, l2, r2, k) = input.readLine().split("\\s+".toRegex()).map { it.toLong() }

    val start = Math.max(l1, l2)
    val end = Math.min(r1, r2)

    val answer = when {
        start > end -> 0
        else -> (end - start + 1).let { if (k in start..end) it - 1 else it }
    }

    output.println(answer)
}

fun main(vararg args: String) {
    val (l1, r1, l2, r2, k) = readLine()!!.split(' ').map { it.toLong() }
    val l = Math.max(l1, l2)
    val r = Math.min(r1, r2)
    if (l > r) {
        println(0)
    } else {
        var o = r - l + 1
        if (l <= k && k <= r) o -= 1
        println(o)
    }
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    //val len = r.readLine()!!.toInt()
    //val v = r.readLine()!!.split(" ").map { it.toInt() }
    val v = r.readLine()!!.split("").filter { it.isNotEmpty() }.map { it.toInt() }.toIntArray()
    val ans = mutableListOf<Int>()
    while (v.any { it > 0 }){
        val a = IntArray(v.size){0}
        for (i in 0..v.size-1){
            if (v[i]>0) {
                v[i]--
                a[i]++
            }
        }
        ans += a.joinToString("").toInt()
    }
    println(ans.size)
    println(ans.joinToString(" "))
    /*repeat(r.readLine()!!.toInt()) {
        val (n, k) = r.readLine()!!.split(" ").map { it.toLong() }
    }*/

}

import kotlin.math.max
import kotlin.math.min

fun main() {
    val n = readLine()!!.toInt()

    val list = mutableListOf<Int>()

    val s = System.currentTimeMillis()
    fillList(list)

    var arr = IntArray(1_000_001, { p -> -1 })
    var prev = IntArray(1_000_001, { p -> -1 })
    list.forEach {
        arr[it] = 1
    }

    for (i in 1..n) {
        list.forEach { elem ->
            val index = i - elem

            if (index > 0 && arr[index] != -1) {
                if (arr[i] == -1) {
                    arr[i] = arr[index] + 1
                    prev[i] = index
                } else if (arr[i] > arr[index] + 1) {
                    arr[i] = arr[index] + 1
                    prev[i] = index
                }
            }
        }
    }

    println(arr[n])

    var i = n
    while (prev[i] != -1) {
        println(i - prev[i])
        i = prev[i]
    }
    println(i)

}

fun fillList(list: MutableList<Int>) {

    for (i in 1..1_000_000)
        if (check(i)) {
//            println(i)
            list.add(i)
        }

}

fun check(elem: Int): Boolean {
    var elem = elem
    while (elem > 0) {
        if (elem % 10 >= 2)
            return false
        elem /= 10
    }

    return true
}

import kotlin.math.max
import kotlin.math.min

fun main() {
    val n = readLine()!!.toInt()

    val list = mutableListOf<Int>()

    val s = System.currentTimeMillis()
    for (i in 1..1_000_000)
        if (check(i)) {
//            println(i)
            list.add(i)
        }

//    print(System.currentTimeMillis() - s)

    var arr = IntArray(1_000_001, { p -> -1 })
    var prev = IntArray(1_000_001, { p -> -1 })
    list.forEach {
        arr[it] = 1
    }

    for (i in 1..n) {
        list.forEach { elem ->
            val index = i - elem

            if (index > 0 && arr[index] != -1) {
                if (arr[i] == -1) {
                    arr[i] = arr[index] + 1
                    prev[i] = index
                } else if (arr[i] > arr[index] + 1) {
                    arr[i] = arr[index] + 1
                    prev[i] = index
                }
            }
        }
    }

    println(arr[n])

    var i = n
    while(prev[i] != -1){
        println(i - prev[i])
        i = prev[i]
    }
    println(i)

}

fun check(elem: Int): Boolean {
    var elem = elem
    while (elem > 0) {
        if (elem % 10 >= 2)
            return false
        elem /= 10
    }

    return true
}

import java.util.*

var INF = 1000001

fun generate(n: Int, list: ArrayList<Int>){
    list.add(n)
    if(n * 10 < INF) generate(n * 10,list)
    if (n * 10 + 1 < INF) generate(n * 10 + 1,list)
}

fun  getSequnece(dp: Array<Int>, from: Array<Int>, i: Int) {
    if(from[i] == -1) print("$i ")
    else {
        getSequnece(dp,from,from[i])
        getSequnece(dp,from,i - from[i])
    }
}

fun main(args: Array<String>) {
    var s = readLine()!!.toInt()
    var l = ArrayList<Int>()
    generate(1,l)
    Collections.sort(l)
    var dp = Array(1000001) {i -> i}
    var from = Array(1000001) { i -> i - 1}
    dp[0] = 0
    l.forEach {
        dp[it] = 1
        from[it] = -1
    }
    (0..1000000).forEach {
        i ->
        l.forEach {
            if(i - it > 0) {
                if(dp[i - it] + dp[it] < dp[i]) {
                    dp[i] = dp[i - it] + dp[it]
                    from[i] = it
                }
            }
        }
    }
    println(dp[s])
    getSequnece(dp,from,s)
}

import java.util.*

var INF = 1000001

fun generate(n: Int, list: ArrayList<Int>){
    list.add(n)
    if(n * 10 < INF) generate(n * 10,list)
    if (n * 10 + 1 < INF) generate(n * 10 + 1,list)
}

tailrec fun getSequnece(dp: Array<Int>, from: Array<Int>, i: Int) {
    if(from[i] == -1) print("$i ")
    else {
        print("${from[i]} ")
        getSequnece(dp, from, i - from[i])
    }
}

fun main(args: Array<String>) {
    var s = readLine()!!.toInt()
    var l = ArrayList<Int>()
    generate(1,l)
    Collections.sort(l)
    var dp = Array(1000001) {i -> i}
    var from = Array(1000001) { i -> 1}
    dp[0] = 0
    l.forEach {
        dp[it] = 1
        from[it] = -1
    }
    (0..1000000).forEach {
        i ->
        l.forEach {
            if(i - it > 0) {
                if(dp[i - it] + dp[it] < dp[i]) {
                    dp[i] = dp[i - it] + dp[it]
                    from[i] = it
                }
            }
        }
    }
    println(dp[s])
    getSequnece(dp,from,s)
}

fun main() {
    val n = readLine()!!.toCharArray()
    var sol = 0
    val sols = mutableListOf<MutableList<Char>>()
    while (true) {
        val newSol = mutableListOf<Char>()
        for ((pos, c) in n.withIndex()) {
            if (c == '0' && newSol.isNotEmpty()) newSol.add('0') else if (c != '0') {
                n[pos]--
                newSol.add('1')
            }
        }
        if (newSol.isEmpty()) {
            break
        }
        sol++
        sols.add(newSol)
    }
    println(sol)
    print(sols.joinToString(separator = " ") { it.joinToString("") })
}

fun main() {
    fun readInt() = readLine()!!.toInt()
    fun readLong() = readLine()!!.toLong()
    fun readInts() = readLine()!!.split(" ").map(String::toInt)
    fun readLongs() = readLine()!!.split(" ").map(String::toLong)

    var n = readLine()!!.toCharArray()
    var sol = 0
    var sols = mutableListOf<MutableList<Char>>()
    var zeros = false
    while (!zeros) {
        val newSol = mutableListOf<Char>()
        for ((pos, c) in n.withIndex()) {
            if (c == '0' && newSol.isNotEmpty()) {
                newSol.add('0')
            } else if (c != '0') {
                n[pos]--
                newSol.add('1')
            }
        }
        if (newSol.isNotEmpty()) {
            sol++
            sols.add(newSol)
        } else {
            zeros = true
        }
    }
    println(sol)
    print(sols.joinToString(separator = " ") { it.joinToString("") })
}

fun quasi_binary() : ArrayList<Int> {
  val q_b = ArrayList<Int>()
  val max_depth = 7
  fun dfs(depth : Int, qb : Int) {
    if (depth > max_depth) {
      return
    } else {
      q_b.add(qb)
      val qb_0 = qb * 10
      val qb_1 = qb_0 + 1
      val new_depth = depth + 1
      dfs(new_depth, qb_0)
      dfs(new_depth, qb_1)
    }
  }
  dfs(1, 1)
  q_b.sort()
  return q_b
}

fun qb_sum(qb : ArrayList<Int>, n : Int) : ArrayList<Int> {
  val predecessor = IntArray(n + 1)
  val num_terms = IntArray(n + 1, {_ -> Int.MAX_VALUE})
  num_terms[0] = 0
  val term = IntArray(n + 1)
  for (i in 0 .. n) {
    for (x in qb) {
      val sum = i + x
      if (sum <= n) {
        val num_terms_so_far = num_terms[i] + 1
        if (num_terms_so_far < num_terms[sum]) {
          num_terms[sum] = num_terms_so_far
          term[sum] = x
          predecessor[sum] = i
        }
      } else {
        break
      }
    }
  }
  val terms = ArrayList<Int>()
  var x = n
  while (x > 0) {
    terms.add(term[x])
    x = predecessor[x]
  }
  return terms
}

fun main(args : Array<String>) {
  val n_nullable_str = readLine()
  if (n_nullable_str == null) {
    // Do nothing ...
  } else {
    val n_str = n_nullable_str
    val n = n_str.toInt()
    val q_b = quasi_binary()
    val terms = qb_sum(q_b, n)
    val num_terms = terms.size
    println("${num_terms}")
    for (t in terms) {
      print("${t} ")
    }
    println()
  }
}

fun main(args: Array<String>) {
    val number= readLine()!!.map { it-> (it-'0') }.toIntArray()
    var canCreateNumber=true
    val binNubmers= mutableListOf<String>()
    while (canCreateNumber){
        var currenNumber= mutableListOf<Int>()
        for ((index, value) in number.withIndex()){
            if(value>0){
                currenNumber.add(1)
                number[index]-=1
            }
            else{
                if(currenNumber.size>0)
                    currenNumber.add(0)
            }
        }
        if (currenNumber.size==0)
            break
        binNubmers.add(currenNumber.joinToString(""))
    }
    println(binNubmers.size)
    println(binNubmers.joinToString(" "))
}

import java.util.*

var INF = 1000001

fun generate(n: Int, list: ArrayList<Int>){
    list.add(n)
    if(n * 10 < INF) generate(n * 10,list)
    if (n * 10 + 1 < INF) generate(n * 10 + 1,list)
}

tailrec fun getSequnece(dp: Array<Int>, from: Array<Int>, i: Int) {
    if(from[i] == -1) print("$i ")
    else {
        print("${from[i]} ")
        getSequnece(dp, from, i - from[i])
    }
}

fun main(args: Array<String>) {
    var s = readLine()!!.toInt()
    var l = ArrayList<Int>()
    generate(1,l)
    Collections.sort(l)
    var dp = Array(1000001) {i -> i}
    var from = Array(1000001) { i -> i - 1}
    dp[0] = 0
    l.forEach {
        dp[it] = 1
        from[it] = -1
    }
    (0..1000000).forEach {
        i ->
        l.forEach {
            if(i - it > 0) {
                if(dp[i - it] + dp[it] < dp[i]) {
                    dp[i] = dp[i - it] + dp[it]
                    from[i] = it
                }
            }
        }
    }
    println(dp[s])
    getSequnece(dp,from,s)
}

import java.util.*

var INF = 1000001

fun generate(n: Int, list: ArrayList<Int>){
    list.add(n)
    if(n * 10 < INF) generate(n * 10,list)
    if (n * 10 + 1 < INF) generate(n * 10 + 1,list)
}

fun  getSequnece(dp: Array<Int>, from: Array<Int>, i: Int) {
    if(from[i] == -1) print("$i ")
    else {
        getSequnece(dp,from,from[i])
        getSequnece(dp,from,i - from[i])
    }
}

fun main(args: Array<String>) {
    var s = readLine()!!.toInt()
    var l = ArrayList<Int>()
    generate(1,l)
    Collections.sort(l)
    var dp = Array(1000001) {i -> i}
    var from = Array(1000001) { i -> i - 1}
    dp[0] = 0
    l.forEach {
        dp[it] = 1
        from[it] = -1
    }
    (0..100000).forEach {
        i ->
        l.forEach {
            if(i - it > 0) {
                if(dp[i - it] + dp[it] < dp[i]) {
                    dp[i] = dp[i - it] + dp[it]
                    from[i] = it
                }
            }
        }
    }
    println(dp[s])
    getSequnece(dp,from,s)
}

fun quasi_binary() : ArrayList<Int> {
  val q_b = ArrayList<Int>()
  val max_depth = 7
  fun dfs(depth : Int, qb : Int) {
    if (depth > max_depth) {
      return
    } else {
      q_b.add(qb)
      val qb_0 = qb * 10
      val qb_1 = qb_0 + 1
      val new_depth = depth + 1
      dfs(new_depth, qb_0)
      dfs(new_depth, qb_1)
    }
  }
  dfs(1, 1)
  q_b.sort()
  return q_b
}

fun qb_sum(qb : ArrayList<Int>, n : Int, terms : ArrayList<Int>) {
  if (n == 0) {
    // Do nothing ...
  } else {
    var l = 0
    var u = qb.size - 1
    while ((u - l) > 1) {
      val m = (l + u) / 2
      val qb_m = qb[m]
      if (qb_m <= n) {
        l = m
      } else {
        u = m
      }
    }
    val qb_l = qb[l]
    val new_n = n - qb_l
    terms.add(qb_l)
    qb_sum(qb, new_n, terms)
  }
  return
}

fun main(args : Array<String>) {
  val n_nullable_str = readLine()
  if (n_nullable_str == null) {
    // Do nothing ...
  } else {
    val n_str = n_nullable_str
    val n = n_str.toInt()
    val q_b = quasi_binary()
    val terms = ArrayList<Int>()
    qb_sum(q_b, n, terms)
    val num_terms = terms.size
    println("${num_terms}")
    for (t in terms) {
      print("${t} ")
    }
    println()
  }
}


// based on tutorial
fun main() {
    val (a, b, c) = readLine()!!.split(" ").map(String::toInt)
    if ((a + b + c) % 2 == 1) return print("Impossible")
    val y = (b - a + c) / 2
    val x = a + y - c
    val z = a - x
    if (x < 0 || y < 0 || z < 0) return print("Impossible")
    print("$x $y $z")
}

// 36 minutes, debugging needed
//fun main() {
//    fun readInts() = readLine()!!.split(" ").map(String::toInt)
//
//    val valences = readInts().mapIndexed { index, i -> i to index }.sortedBy { it.first }.toTypedArray()
//    if (valences[0].first + valences[1].first < valences[2].first) return print("Impossible")
//    if (valences.sumBy { it.first } % 2 == 1) return print("Impossible")
//    val sumToPos = mapOf(1 to 0, 3 to 1, 2 to 2)
//    val bonds = arrayOf(0, 0, 0)
//    // step 1: valences 0 and 1 became the same
//    if (valences[0].first != valences[1].first) {
//        val delta = valences[1].first - valences[0].first
//        bonds[sumToPos[valences[1].second + valences[2].second]!!] = delta
//        valences[1] = valences[1].first - delta to valences[1].second
//        valences[2] = valences[2].first - delta to valences[2].second
//    }
//    // step 2: all valences became the same
//    if (valences[0].first != valences[2].first) {
//        val delta = valences[2].first - valences[0].first
//        bonds[sumToPos[valences[0].second + valences[2].second]!!] += delta
//        bonds[sumToPos[valences[1].second + valences[2].second]!!] += delta
//        valences[0] = valences[0].first - delta to valences[0].second
//    }
//    // step 3: all valences are the same, add to bonds the value
//    for (pos in 0 .. 2)
//        bonds[pos] += valences[0].first / 2
//    print(bonds.joinToString(" "))
//}

import java.io.*
import java.math.BigDecimal
import java.math.BigInteger
import java.util.*

object programkt {
    interface Scanner {
        fun changeInputStream(inputStream: InputStream)
        fun nextInt(): Int
        fun nextLong(): Long
        fun nextDouble(): Double
        fun nextChar(): Char
        fun nextString(): String
        fun nextLine(): String
        fun nextBigInteger(): BigInteger
        fun nextBigDecimal(): BigDecimal
    }

    abstract class Task {
        //KT Extensions
        fun <T : Comparable<T>> min(a: T, b: T) = if (a > b) b else a
        fun <T : Comparable<T>> max(a: T, b: T) = if (a < b) b else a
        fun abs(a: Int) = if (a > 0) a else -(a)
        fun abs(a: Long) = if (a > 0) a else -(a)
        fun abs(a: Float) = if (a > 0) a else -(a)
        fun abs(a: Double) = if (a > 0) a else -(a)
        operator fun <T> Iterable<T>.invoke(function: (it: T) -> Unit) { this.forEach(function) }
        private fun String.prefix(pi: Array<Int>): Array<Int> {
            pi[0] = 0
            (1 until this.length) {
                var j = pi[it - 1]
                while (j > 0 && this[it] != this[j]) {
                    j = pi[j - 1]
                }
                if(this[it] == this[j]) {
                    j++
                }
                pi[it] = j
            }
            return pi
        }
        private fun String.kmpFind(pattern: String): Int {
            val m = pattern.length
            val dfa = Array(256) { IntArray(m) }
            dfa[pattern[0].toInt()][0] = 1
            var x = 0
            var j = 1
            while (j < m) {
                for (c in 0 until 256) {
                    dfa[c][j] = dfa[c][x]        // Copy mismatch cases.
                }
                dfa[pattern[j].toInt()][j] = j + 1   // Set match case.
                x = dfa[pattern[j].toInt()][x]       // Update restart state.
                j++
            }

            val n = this.length
            var i: Int = 0
            j = 0
            while (i < n && j < m) {
                j = dfa[this[i].toInt()][j]
                i++
            }
            if (j == m) return i - m    // found
            return n                    // not found
        }
        fun fuckExceptions(invoker: () -> Unit) = try { invoker.invoke() } catch (_: Throwable) {}

        enum class EdgeType {
            DIRECTED,
            UNDIRECTED
        }
        data class Vertex<T: Comparable<T>>(
                val data: T
        ) {
            override fun toString(): String = "V:$data"
        }
        data class Edge<T:Comparable<T>>(
                var source: Vertex<T>,
                var destination: Vertex<T>,
                val weight: Double?
        )
        interface Graphable<T: Comparable<T>> {
            fun createVertex(data: T): Vertex<T>
            fun add(type: EdgeType, source: Vertex<T>, destination: Vertex<T>, weight: Double? = 0.0)
            fun weight(source: Vertex<T>, destination: Vertex<T>): Double?
            fun edges(source: Vertex<T>): MutableList<Edge<T>>?
        }
        class AdjacencyList<T: Comparable<T>>: Graphable<T> {
            var adjacencyMap: MutableMap<Vertex<T>, MutableList<Edge<T>>> = mutableMapOf()

            private fun addDirectedEdge(source: Vertex<T>, destination: Vertex<T>, weight: Double?) {
                adjacencyMap[source]?.add(Edge(source = source, destination = destination, weight = weight))
            }

            private fun addUndirectedEdge(source: Vertex<T>, destination: Vertex<T>, weight: Double?) {
                addDirectedEdge(source, destination, weight)
                addDirectedEdge(destination, source, weight)
            }

            override fun createVertex(data: T): Vertex<T> {
                val vertex = Vertex(data = data)
                adjacencyMap[vertex] ?: run {
                    adjacencyMap[vertex] = mutableListOf()
                }
                return vertex
            }

            override fun add(type: EdgeType, source: Vertex<T>, destination: Vertex<T>, weight: Double?) = when(type) {
                EdgeType.DIRECTED -> addDirectedEdge(source, destination, weight)
                EdgeType.UNDIRECTED -> addUndirectedEdge(source, destination, weight)
            }

            override fun weight(source: Vertex<T>, destination: Vertex<T>): Double? {
                adjacencyMap[source]?.forEach {
                    if(it.destination == destination) return it.weight
                }
                return null
            }

            override fun edges(source: Vertex<T>): MutableList<Edge<T>>? = adjacencyMap[source]

            override fun toString(): String {
                var result = ""
                for ((vertex, edges) in adjacencyMap) {
                    var edgeString = ""
                    for ((index, edge) in edges.withIndex()) {
                        edgeString += if (index != edges.count() - 1) "${edge.destination}, "
                        else "${edge.destination}"
                    }
                    result += "$vertex ---> [ $edgeString ] \n"
                }
                return result
            }

            fun depthFirstSearch(start: Vertex<T>, end: Vertex<T>): Stack<Vertex<T>> {
                val visited: HashSet<Vertex<T>> = hashSetOf()
                val stack: Stack<Vertex<T>> = Stack()
                stack.push(start)
                visited.add(start)

                var currentVertex = stack.peek()
                loop@while (currentVertex != null && currentVertex != end) {
                    val neighbors = edges(currentVertex)
                    if(neighbors != null && neighbors.count() > 0) {
                        for(edge in neighbors) {
                            if(!visited.contains(edge.destination)) {
                                visited.add(edge.destination)
                                stack.push(edge.destination)
                                currentVertex = stack.peek()
                                continue@loop
                            }
                        }
                    } else {
                        stack.pop()
                        currentVertex = stack.peek()
                        continue
                    }

                    stack.pop()
                    currentVertex = stack.peek()
                }

                return stack
            }

            fun breadthFirstSearch() {

            }

            fun floydWarshallAlgorythm(): Pair<Array<DoubleArray>, Array<IntArray>> {
                val nVertices = this.adjacencyMap.size

                val weights = Array(nVertices) { Array(nVertices-1) { 0.0 } }
                this.adjacencyMap
                        .asSequence()
                        .map { it.value }
                        .withIndex()
                        .forEach { (index, weightsOfVertex) ->
                            weightsOfVertex.asSequence()
                                    .withIndex()
                                    .forEach { (weightIndex, weight) ->
                                        weights[index][weightIndex] = weight.weight!!
                                    }
                        }

                val dist = Array(nVertices) { DoubleArray(nVertices) { Double.POSITIVE_INFINITY } }
                for (w in weights) dist[(w[0] - 1).toInt()][(w[1] - 1).toInt()] = w[2]
                val next = Array(nVertices) { IntArray(nVertices) }
                for (i in 0 until next.size) {
                    for (j in 0 until next.size) {
                        if (i != j) next[i][j] = j + 1
                    }
                }
                for (k in 0 until nVertices) {
                    for (i in 0 until nVertices) {
                        for (j in 0 until nVertices) {
                            if (dist[i][k] + dist[k][j] < dist[i][j]) {
                                dist[i][j] = dist[i][k] + dist[k][j]
                                next[i][j] = next[i][k]
                            }
                        }
                    }
                }
                return dist to next
            }
        }

        fun <T: Comparable<T>> TreeMap<T, Array<Double>>.toAdjacencyList(type: EdgeType): AdjacencyList<T> {
            val list = AdjacencyList<T>()

            this.keys.forEach { list.createVertex(it) }
            this.entries
                    .asSequence()
                    .withIndex()
                    .forEach { (x, edge) ->
                        val vertex = list.createVertex(edge.key)
                        edge.value
                                .asSequence()
                                .withIndex()
                                .forEach { (y, weight) ->
                                    if(weight != .0 && y != x)
                                        list.add(type, vertex, list.createVertex(this.keys.elementAt(y)), weight)
                                }
                    }
            return list
        }
        //End KT Extensions

        abstract fun solve(scanner: Scanner, printer: PrintWriter)
    }

    class FastScanner: Scanner {
        var inputStream: InputStream? = null
        override fun changeInputStream(inputStream: InputStream) {
            this.inputStream = inputStream
            this.bufferedReader = BufferedReader(InputStreamReader(inputStream))
        }

        private lateinit var bufferedReader: BufferedReader
        private var stringTokenizer: StringTokenizer? = null

        private fun nextToken(): String? {
            while (stringTokenizer == null || !stringTokenizer!!.hasMoreTokens())
                stringTokenizer = StringTokenizer(bufferedReader.readLine() ?: return null)
            return stringTokenizer!!.nextToken()
        }

        override fun nextInt() = nextToken()!!.toInt()
        override fun nextLong() = nextToken()!!.toLong()
        override fun nextDouble() = nextToken()!!.toDouble()
        override fun nextChar() = bufferedReader.read().toChar()
        override fun nextString() = nextToken()!!
        override fun nextLine() = bufferedReader.readLine()!!
        override fun nextBigInteger() = BigInteger(nextToken()!!)
        override fun nextBigDecimal() = BigDecimal(nextToken()!!)
    }

    class TaskBuilder {
        private var task: Task? = null
        private var inputStream: InputStream? = null
        private var outputStream: OutputStream? = null
        private var scanner: Scanner? = null

        fun useInputSource(inputStream: InputStream): TaskBuilder {
            this.inputStream = inputStream
            return this
        }

        fun useOutputSource(outputStream: OutputStream): TaskBuilder {
            this.outputStream = outputStream
            return this
        }

        fun useInputFile(inputFileName: String): TaskBuilder {
            this.inputStream = FileInputStream(File(inputFileName))
            return this
        }

        fun useOutputFile(outputFileName: String): TaskBuilder {
            this.outputStream = FileOutputStream(File(outputFileName))
            return this
        }

        fun useScanner(scanner: Scanner): TaskBuilder {
            this.scanner = scanner
            return this
        }

        fun solveTask(task: Task): TaskBuilder {
            this.task = task
            return this
        }

        fun run() {
            when {
                task == null -> throw NullPointerException("Task cannot be null!")
                inputStream == null -> throw NullPointerException("Input cannot be null!")
                outputStream == null -> throw NullPointerException("Output cannot be null!")
                scanner == null -> throw NullPointerException("Scanner cannot be null!")
            }
            scanner!!.changeInputStream(inputStream!!)
            val printer = PrintWriter(outputStream)
            TaskRunnable(task!!, scanner!!, printer).run()

            inputStream!!.close()
            printer.close()
        }

        class TaskRunnable(
                private val task: Task,
                private val scanner: Scanner,
                private val printer: PrintWriter
        ) {
            fun run() {
                task.solve(scanner, printer)
            }
        }
    }

    @JvmStatic
    fun main(args: Array<String>) = TaskBuilder()
            .useInputSource(System.`in`)
            .useOutputSource(System.out)
            .useScanner(FastScanner())
            .solveTask(TaskA())
            .run()

    class TaskA: Task() {
        override fun solve(scanner: Scanner, printer: PrintWriter) {
            val (firstValency, secondValency, thirdValency) = scanner.nextLine()
                    .split(" ")
                    .map { it.toLong() }
            val averageValency = (firstValency + secondValency + thirdValency) / 2

            if ((firstValency + secondValency + thirdValency) % 2 != 0L ) { printer.println("Impossible"); return }

            val countOfConnectionsFirst = averageValency - thirdValency
            val countOfConnectionsSecond = averageValency - firstValency
            val countOfConnectionsThird = averageValency - secondValency

            when {
                countOfConnectionsFirst < 0 -> { printer.println("Impossible"); return }
                countOfConnectionsSecond < 0 -> { printer.println("Impossible"); return }
                countOfConnectionsThird < 0 -> { printer.println("Impossible"); return }
                else -> printer.println("$countOfConnectionsFirst $countOfConnectionsSecond $countOfConnectionsThird")
            }
        }

    }
}

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val valences = readInts().mapIndexed { index, i -> i to index }.sortedBy { it.first }.toTypedArray()
    if (valences[0].first + valences[1].first < valences[2].first) return print("Impossible")
    if (valences.sumBy { it.first } % 2 == 1) return print("Impossible")
    val sumToPos = mapOf(1 to 0, 3 to 1, 2 to 2)
    val bonds = arrayOf(0, 0, 0)
    // step 1: valences 0 and 1 became the same
    if (valences[0].first != valences[1].first) {
        val delta = valences[1].first - valences[0].first
        bonds[sumToPos[valences[1].second + valences[2].second]!!] = delta
        valences[1] = valences[1].first - delta to valences[1].second
        valences[2] = valences[2].first - delta to valences[2].second
    }
    // step 2: all valences became the same
    if (valences[0].first != valences[2].first) {
        val delta = valences[2].first - valences[0].first
        bonds[sumToPos[valences[0].second + valences[2].second]!!] += delta
        bonds[sumToPos[valences[1].second + valences[2].second]!!] += delta
        valences[0] = valences[0].first - delta to valences[0].second
    }
    // step 3: all valences are the same, add to bonds the value
    for (pos in 0 .. 2)
        bonds[pos] += valences[0].first / 2
    print(bonds.joinToString(" "))
}

import java.io.*
import java.math.BigDecimal
import java.math.BigInteger
import java.util.*

object programkt {
    interface Scanner {
        fun changeInputStream(inputStream: InputStream)
        fun nextInt(): Int
        fun nextLong(): Long
        fun nextDouble(): Double
        fun nextChar(): Char
        fun nextString(): String
        fun nextLine(): String
        fun nextBigInteger(): BigInteger
        fun nextBigDecimal(): BigDecimal
    }

    abstract class Task {
        //KT Extensions
        fun <T : Comparable<T>> min(a: T, b: T) = if (a > b) b else a
        fun <T : Comparable<T>> max(a: T, b: T) = if (a < b) b else a
        fun abs(a: Int) = if (a > 0) a else -(a)
        fun abs(a: Long) = if (a > 0) a else -(a)
        fun abs(a: Float) = if (a > 0) a else -(a)
        fun abs(a: Double) = if (a > 0) a else -(a)
        operator fun <T> Iterable<T>.invoke(function: (it: T) -> Unit) { this.forEach(function) }
        private fun String.prefix(pi: Array<Int>): Array<Int> {
            pi[0] = 0
            (1 until this.length) {
                var j = pi[it - 1]
                while (j > 0 && this[it] != this[j]) {
                    j = pi[j - 1]
                }
                if(this[it] == this[j]) {
                    j++
                }
                pi[it] = j
            }
            return pi
        }
        private fun String.kmpFind(pattern: String): Int {
            val m = pattern.length
            val dfa = Array(256) { IntArray(m) }
            dfa[pattern[0].toInt()][0] = 1
            var x = 0
            var j = 1
            while (j < m) {
                for (c in 0 until 256) {
                    dfa[c][j] = dfa[c][x]        // Copy mismatch cases.
                }
                dfa[pattern[j].toInt()][j] = j + 1   // Set match case.
                x = dfa[pattern[j].toInt()][x]       // Update restart state.
                j++
            }

            val n = this.length
            var i: Int = 0
            j = 0
            while (i < n && j < m) {
                j = dfa[this[i].toInt()][j]
                i++
            }
            if (j == m) return i - m    // found
            return n                    // not found
        }
        fun fuckExceptions(invoker: () -> Unit) = try { invoker.invoke() } catch (_: Throwable) {}

        enum class EdgeType {
            DIRECTED,
            UNDIRECTED
        }
        data class Vertex<T: Comparable<T>>(
                val data: T
        ) {
            override fun toString(): String = "V:$data"
        }
        data class Edge<T:Comparable<T>>(
                var source: Vertex<T>,
                var destination: Vertex<T>,
                val weight: Double?
        )
        interface Graphable<T: Comparable<T>> {
            fun createVertex(data: T): Vertex<T>
            fun add(type: EdgeType, source: Vertex<T>, destination: Vertex<T>, weight: Double? = 0.0)
            fun weight(source: Vertex<T>, destination: Vertex<T>): Double?
            fun edges(source: Vertex<T>): MutableList<Edge<T>>?
        }
        class AdjacencyList<T: Comparable<T>>: Graphable<T> {
            var adjacencyMap: MutableMap<Vertex<T>, MutableList<Edge<T>>> = mutableMapOf()

            private fun addDirectedEdge(source: Vertex<T>, destination: Vertex<T>, weight: Double?) {
                adjacencyMap[source]?.add(Edge(source = source, destination = destination, weight = weight))
            }

            private fun addUndirectedEdge(source: Vertex<T>, destination: Vertex<T>, weight: Double?) {
                addDirectedEdge(source, destination, weight)
                addDirectedEdge(destination, source, weight)
            }

            override fun createVertex(data: T): Vertex<T> {
                val vertex = Vertex(data = data)
                adjacencyMap[vertex] ?: run {
                    adjacencyMap[vertex] = mutableListOf()
                }
                return vertex
            }

            override fun add(type: EdgeType, source: Vertex<T>, destination: Vertex<T>, weight: Double?) = when(type) {
                EdgeType.DIRECTED -> addDirectedEdge(source, destination, weight)
                EdgeType.UNDIRECTED -> addUndirectedEdge(source, destination, weight)
            }

            override fun weight(source: Vertex<T>, destination: Vertex<T>): Double? {
                adjacencyMap[source]?.forEach {
                    if(it.destination == destination) return it.weight
                }
                return null
            }

            override fun edges(source: Vertex<T>): MutableList<Edge<T>>? = adjacencyMap[source]

            override fun toString(): String {
                var result = ""
                for ((vertex, edges) in adjacencyMap) {
                    var edgeString = ""
                    for ((index, edge) in edges.withIndex()) {
                        edgeString += if (index != edges.count() - 1) "${edge.destination}, "
                        else "${edge.destination}"
                    }
                    result += "$vertex ---> [ $edgeString ] \n"
                }
                return result
            }

            fun depthFirstSearch(start: Vertex<T>, end: Vertex<T>): Stack<Vertex<T>> {
                val visited: HashSet<Vertex<T>> = hashSetOf()
                val stack: Stack<Vertex<T>> = Stack()
                stack.push(start)
                visited.add(start)

                var currentVertex = stack.peek()
                loop@while (currentVertex != null && currentVertex != end) {
                    val neighbors = edges(currentVertex)
                    if(neighbors != null && neighbors.count() > 0) {
                        for(edge in neighbors) {
                            if(!visited.contains(edge.destination)) {
                                visited.add(edge.destination)
                                stack.push(edge.destination)
                                currentVertex = stack.peek()
                                continue@loop
                            }
                        }
                    } else {
                        stack.pop()
                        currentVertex = stack.peek()
                        continue
                    }

                    stack.pop()
                    currentVertex = stack.peek()
                }

                return stack
            }

            fun breadthFirstSearch() {

            }

            fun floydWarshallAlgorythm(): Pair<Array<DoubleArray>, Array<IntArray>> {
                val nVertices = this.adjacencyMap.size

                val weights = Array(nVertices) { Array(nVertices-1) { 0.0 } }
                this.adjacencyMap
                        .asSequence()
                        .map { it.value }
                        .withIndex()
                        .forEach { (index, weightsOfVertex) ->
                            weightsOfVertex.asSequence()
                                    .withIndex()
                                    .forEach { (weightIndex, weight) ->
                                        weights[index][weightIndex] = weight.weight!!
                                    }
                        }

                val dist = Array(nVertices) { DoubleArray(nVertices) { Double.POSITIVE_INFINITY } }
                for (w in weights) dist[(w[0] - 1).toInt()][(w[1] - 1).toInt()] = w[2]
                val next = Array(nVertices) { IntArray(nVertices) }
                for (i in 0 until next.size) {
                    for (j in 0 until next.size) {
                        if (i != j) next[i][j] = j + 1
                    }
                }
                for (k in 0 until nVertices) {
                    for (i in 0 until nVertices) {
                        for (j in 0 until nVertices) {
                            if (dist[i][k] + dist[k][j] < dist[i][j]) {
                                dist[i][j] = dist[i][k] + dist[k][j]
                                next[i][j] = next[i][k]
                            }
                        }
                    }
                }
                return dist to next
            }
        }

        fun <T: Comparable<T>> TreeMap<T, Array<Double>>.toAdjacencyList(type: EdgeType): AdjacencyList<T> {
            val list = AdjacencyList<T>()

            this.keys.forEach { list.createVertex(it) }
            this.entries
                    .asSequence()
                    .withIndex()
                    .forEach { (x, edge) ->
                        val vertex = list.createVertex(edge.key)
                        edge.value
                                .asSequence()
                                .withIndex()
                                .forEach { (y, weight) ->
                                    if(weight != .0 && y != x)
                                        list.add(type, vertex, list.createVertex(this.keys.elementAt(y)), weight)
                                }
                    }
            return list
        }
        //End KT Extensions

        abstract fun solve(scanner: Scanner, printer: PrintWriter)
    }

    class FastScanner: Scanner {
        var inputStream: InputStream? = null
        override fun changeInputStream(inputStream: InputStream) {
            this.inputStream = inputStream
            this.bufferedReader = BufferedReader(InputStreamReader(inputStream))
        }

        private lateinit var bufferedReader: BufferedReader
        private var stringTokenizer: StringTokenizer? = null

        private fun nextToken(): String? {
            while (stringTokenizer == null || !stringTokenizer!!.hasMoreTokens())
                stringTokenizer = StringTokenizer(bufferedReader.readLine() ?: return null)
            return stringTokenizer!!.nextToken()
        }

        override fun nextInt() = nextToken()!!.toInt()
        override fun nextLong() = nextToken()!!.toLong()
        override fun nextDouble() = nextToken()!!.toDouble()
        override fun nextChar() = bufferedReader.read().toChar()
        override fun nextString() = nextToken()!!
        override fun nextLine() = bufferedReader.readLine()!!
        override fun nextBigInteger() = BigInteger(nextToken()!!)
        override fun nextBigDecimal() = BigDecimal(nextToken()!!)
    }

    class TaskBuilder {
        private var task: Task? = null
        private var inputStream: InputStream? = null
        private var outputStream: OutputStream? = null
        private var scanner: Scanner? = null

        fun useInputSource(inputStream: InputStream): TaskBuilder {
            this.inputStream = inputStream
            return this
        }

        fun useOutputSource(outputStream: OutputStream): TaskBuilder {
            this.outputStream = outputStream
            return this
        }

        fun useInputFile(inputFileName: String): TaskBuilder {
            this.inputStream = FileInputStream(File(inputFileName))
            return this
        }

        fun useOutputFile(outputFileName: String): TaskBuilder {
            this.outputStream = FileOutputStream(File(outputFileName))
            return this
        }

        fun useScanner(scanner: Scanner): TaskBuilder {
            this.scanner = scanner
            return this
        }

        fun solveTask(task: Task): TaskBuilder {
            this.task = task
            return this
        }

        fun run() {
            when {
                task == null -> throw NullPointerException("Task cannot be null!")
                inputStream == null -> throw NullPointerException("Input cannot be null!")
                outputStream == null -> throw NullPointerException("Output cannot be null!")
                scanner == null -> throw NullPointerException("Scanner cannot be null!")
            }
            scanner!!.changeInputStream(inputStream!!)
            val printer = PrintWriter(outputStream)
            TaskRunnable(task!!, scanner!!, printer).run()

            inputStream!!.close()
            printer.close()
        }

        class TaskRunnable(
                private val task: Task,
                private val scanner: Scanner,
                private val printer: PrintWriter
        ) {
            fun run() {
                task.solve(scanner, printer)
            }
        }
    }

    @JvmStatic
    fun main(args: Array<String>) = TaskBuilder()
            .useInputSource(System.`in`)
            .useOutputSource(System.out)
            .useScanner(FastScanner())
            .solveTask(TaskA())
            .run()

    class TaskA: Task() {
        override fun solve(scanner: Scanner, printer: PrintWriter) {
            val (firstValency, secondValency, thirdValency) = scanner.nextLine()
                    .split(" ")
                    .map { it.toLong() }
            val averageValency = (firstValency + secondValency + thirdValency) / 2
            val countOfConnectionsFirst = averageValency - thirdValency
            val countOfConnectionsSecond = averageValency - firstValency
            val countOfConnectionsThird = averageValency - secondValency

            when {
                (firstValency + secondValency + thirdValency) / 2 % 1 != 0L -> { printer.println("Impossible"); return }
                countOfConnectionsFirst < 0 -> { printer.println("Impossible"); return }
                countOfConnectionsSecond < 0 -> { printer.println("Impossible"); return }
                countOfConnectionsThird < 0 -> { printer.println("Impossible"); return }
                else -> printer.println("$countOfConnectionsFirst $countOfConnectionsSecond $countOfConnectionsThird")
            }
        }

    }
}


fun main(){
    val b = readLine()!!.split("").distinct().count()
    if ( b % 2 == 1) print( "CHAT WITH HER!" ) else print( "IGNORE HIM!")
}

fun main(args: Array<String>) {
    val count = readLine()!!.toSet().size
    println(if (count % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    print(if (readLine()!!.split("").distinct().drop(1).count() % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args:Array<String>){
    val word = readLine()!!

    val symbols = mutableSetOf<Char>()

    word.forEach {
        symbols.add(it)
    }

    if (symbols.size %2 == 0){
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main(args: Array<String>) {
    var s=readLine()
    if (s == null) s="ADS"
    if (s.chars().distinct().count().toInt() % 2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

import java.util.*

    fun main(){
        var input = Scanner(System.`in`)
        var inputString = input.nextLine()
        if(inputString.toCharArray().distinct().size % 2 == 0){
            print("CHAT WITH HER!")
        }else{
            print("IGNORE HIM!")
        }

    }

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.TreeSet

fun main() {
    output {
        val s = readLn()

        val ans = s.toCollection(HashSet()).size % 2 == 0

        println(if(ans) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

data class Run<T>(val item: T, val num: Int)

fun String.runs() = sequence {
    val i = iterator()

    if(i.hasNext().not()) return@sequence
    var last = i.next()
    var num = 1

    for(e in i) {
        if(last == e) num++
        else {
            yield(Run(last, num))
            last = e
            num = 1
        }
    }
    yield(Run(last, num))
}

/** IO code start */
@JvmField val _reader = System.`in`.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }

@JvmField val _writer = PrintWriter(System.out, false)
inline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }
fun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks

// https://codeforces.com/problemset/problem/236/A

fun main(args: Array<String>) {
    //even female
    //odd mail

    val name = readLn()
    val characterSet = mutableSetOf<Char>()
    for (character in name) {
        characterSet.add(character)
    }
    if (characterSet.size % 2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings(del: String = " ") = readLn().split(del) // list of strings
private fun readInts(del: String = " ") = readStrings(del).map { it.toInt() } // list of ints

import java.util.*

fun main(args: Array<String>) {
        val scan = Scanner(System.`in`)
        val str = scan.next()
        val symbolsList = mutableSetOf<Char>()
        str.forEach {
                symbolsList.add(it)
        }
        if(symbolsList.count() % 2 == 0) {
                println("CHAT WITH HER!")
        } else {
                println("IGNORE HIM!")
        }
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val br = BufferedReader(InputStreamReader(System.`in`))
    val s = br.readLine()
    val distinct = s.groupBy { it }.keys.size
    println(
        if (distinct % 2 == 1){
            "IGNORE HIM!"
        } else {
            "CHAT WITH HER!"
        }
    )
}

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.*

fun main(args: Array<String>) {

    val scanner = Scanner(System.`in`)
    val n = scanner.next()
    val set = TreeSet<Char>()
    for (i in n)
        set.add(i)
    if (set.size % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}
//class Pair(var a: Int, var b: Int): Comparable<Pair> {
//    override fun compareTo(other: Pair): Int {
//        return b - a - other.b + other.a
//    }
//}

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

fun getUnique(s: String): Int {
    val unique = hashSetOf<Char>()
    for (ch in s) unique.add(ch)
    return unique.size
}

fun main(args: Array<String>) {
    val s = readLn()
    println(if (getUnique(s) % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import java.io.PrintWriter
import java.util.Arrays
import java.util.InputMismatchException
import kotlin.math.absoluteValue

lateinit var `is`: InputStream
lateinit var out: PrintWriter
var INPUT = ""

//val oj = System.getProperty("ONLINE_JUDGE") != null
val oj = true
val inbuf = ByteArray(1024)
var lenbuf = 0
var ptrbuf = 0

lateinit var cum: Array<IntArray>

fun solve()
{
    val s = ns()
    val cnt = IntArray(26)

    for(i in 0 until s.length) {
        cnt[(s[i] - 'a')] = 1
    }

    if(cnt.sum() % 2 == 0)
    {
        println("CHAT WITH HER!" )
    }
    else
    {
        println("IGNORE HIM!")
    }
}

fun main() {
    `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())
    out = PrintWriter(System.out)

    val s = System.currentTimeMillis()
    solve()
    out.flush()
    tr((System.currentTimeMillis() - s).toString() + "ms")
}

private fun readByte(): Int {
    if (lenbuf == -1) throw InputMismatchException()
    if (ptrbuf >= lenbuf) {
        ptrbuf = 0
        try {
            lenbuf = `is`.read(inbuf)
        } catch (e: IOException) {
            throw InputMismatchException()
        }

        if (lenbuf <= 0) return -1
    }
    return inbuf[ptrbuf++].toInt()
}

private fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)

private fun skip(): Int {
    var b: Int = readByte()
    while (b != -1 && isSpaceChar(b)) {
        b = readByte()
    }
    return b
}

// using ns()
private fun nd(): Double = ns().toDouble()

// using ns()
private fun nc(): Char = skip().toChar()

// input until whitespace
private fun ns(): String {
    var b = skip()
    val sb = StringBuilder()
    while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')
        sb.appendCodePoint(b)
        b = readByte()
    }
    return sb.toString()
}

private fun ns(n: Int): CharArray {
    val buf = CharArray(n)
    var b = skip()
    var p = 0
    while (p < n && !isSpaceChar(b)) {
        buf[p++] = b.toChar()
        b = readByte()
    }
    return if (n == p) buf else Arrays.copyOf(buf, p)
}

// matrix
private fun nm(n: Int, m: Int): Array<CharArray> {
    val map = Array(n) { CharArray(m) }
    for (i in 0 until n) map[i] = ns(m)
    return map
}

private fun pm(matrix: Array<CharArray>) {
    val n = matrix.size
    val m = matrix[0].size
    repeat(n)
    {
        repeat(m)
        { jt ->
            out.print(matrix[it][jt])
        }
        out.println()
    }
    out.flush()
}

// int array
private fun na(n: Int): IntArray {
    val a = IntArray(n)
    for (i in 0 until n) a[i] = ni()
    return a
}

private fun ni(): Int {
    var num = 0
    var b: Int = readByte()
    var minus = false
    while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {
        b = readByte()
    }
    if (b == '-'.toInt()) {
        minus = true
        b = readByte()
    }

    while (true) {
        if (b >= '0'.toInt() && b <= '9'.toInt()) {
            num = num * 10 + (b - '0'.toInt())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

private fun nl(): Long {
    var num: Long = 0
    var b: Int = readByte()
    var minus = false
    while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {
        b = readByte()
    }
    if (b == '-'.toInt()) {
        minus = true
        b = readByte()
    }

    while (true) {
        if (b >= '0'.toInt() && b <= '9'.toInt()) {
            num = num * 10 + (b - '0'.toInt())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

private fun tr(vararg o: Any) {
//    if (!oj) println(Arrays.deepToString(o))
}

fun main(args: Array<String>) {
    val firstString =readLine()!!.toSet()
    if (firstString.size % 2 == 0 ) print("CHAT WITH HER!") else print("IGNORE HIM!")
}

import java.util.*

fun main(args: Array<String>) {
    var scan = Scanner(System.`in`)

    var name = scan.nextLine()

    var _name = name.toCharArray().distinct()

    if(_name.size %2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

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

class ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {
    var tok = StringTokenizer("")

    companion object {
        fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))
        fun files(inputFilename: String, outputFilename: String) = ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))
    }

    fun readToken(): String {
        while (!tok.hasMoreTokens()) {
            tok = StringTokenizer(rd.readLine())
        }
        return tok.nextToken()
    }

    fun readInt(): Int = readToken().toInt()
    fun <T> print(v: T) = wr.print(v)
    fun <T> println(v: T) = wr.println(v)
    fun close() {
        rd.close()
        wr.close()
    }
}

fun solve() {
    val io = ProblemIO.console()
    val t = io.readToken()
    val l = t.toSet().size
    io.println(if (l % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    io.close()
}

fun main(args: Array<String>) {
    Thread({ solve() }).start()
}

fun main()
{
    var given = readLine()!!
    var done  = ""
    var has = 0
    for (i in given)
    {
        if (done.contains(i)) continue
        else {
            done += i
            has++
        }
    }
        if (has % 2 == 0)
        {
            println("CHAT WITH HER!" )
        }
        else
        {
            println("IGNORE HIM!")
        }
}

fun main() {
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    val n = r.readLine()!!.split("").toSet().size
    println(if (n%2==1) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
        val s = readLine()!!
        if (s.chars().distinct().count() % 2 == 0L)
                print("CHAT WITH HER!")
        else
                print("IGNORE HIM!")
}

fun main(args: Array<String>) {
        var s = readLine()!!
        if (s.chars().distinct().count() % 2 == 0L)
                print("CHAT WITH HER!")
        else
                print("IGNORE HIM!")
}

fun main(args: Array<String>) {
    val a = readLine()!!.toCharArray()
    if (a.distinct().count() % 2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main() {
	val nick = readLine()!!
	val charSet = hashSetOf<Char>()
	nick.forEach {charSet += it }
	println(if (charSet.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.util.regex.Pattern
fun main(args: Array<String>) {

    var text = readLine()!!
    if (Pattern.matches("[a-z]+", text))
    {
        var charArray = text.toCharArray().distinct()
        if (charArray.joinToString("").length%2==0)
        {
            print("CHAT WITH HER!")
        }else
            print("IGNORE HIM!")

    }

}

fun main() {

    val input = readLine()!!.split("")

    val distinctChar = input.distinct()

    if (distinctChar.size % 2 == 0) {
        print("IGNORE HIM!")
    } else {
        print("CHAT WITH HER!")
    }
}

import java.util.*
import kotlin.math.min

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`);
    val n = scanner.next()
    val set = mutableSetOf<Char>()
    for (c in n.asIterable()) {
        set.add(c);
    }

    if (set.count() % 2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    print(if (readLn().split("").distinct().count() % 2 == 1) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    readLine()?.let {
        checkGender(it)
    }
}

fun checkGender(name : String) {
    val counts = name.toSet().size
    val answer = if (counts % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
    println(answer)
}

import java.util.*
import kotlin.collections.HashSet

fun main() {
    val sc = Scanner(System.`in`)
    val s1 = sc.nextLine().toLowerCase()
    val set = HashSet<Char>()
    for (ch in s1)
        set.add(ch)
    print(if(set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.pow
import kotlin.math.sqrt

//private val INPUT = File("input.txt").inputStream()
//private val OUTPUT = File("output.txt").outputStream()
private val INPUT = System.`in`
private val OUTPUT = System.out

private val bufferedReader = INPUT.bufferedReader()
private val outputWriter = PrintWriter(OUTPUT, false)
private fun readLn() = bufferedReader.readLine()!!

private fun readList() = readLn().split(' ')
private var tokenizer = StringTokenizer("")
private fun read(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), " ")
    return tokenizer.nextToken()
}

private fun readInt() = read().toInt()
private fun readLong() = read().toLong()
private fun readDouble() = read().toDouble()

private fun readIntList() = readList().map { it.toInt() }
private fun readLongList() = readList().map { it.toLong() }
private fun readDoubleList() = readList().map { it.toDouble() }

private fun readIntArray(n: Int = 0) =
    if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }

private fun readLongArray(n: Int = 0) =
    if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }

private fun readDoubleArray(n: Int = 0) =
    if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }

private fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)

private class `CF236-D2-A` {
    fun solveTestCase(): String {
        val set = mutableSetOf<Char>()
        for (c in read()) {
            set.add(c)
        }

        return if (set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
    }
}

fun main(args: Array<String>) {
    outputWriter.println(
        `CF236-D2-A`()
            .solveTestCase()
    )

    outputWriter.flush()
}

fun main(args: Array<String>) {
    val name: String = readLine()!!
    val chars: MutableSet<Char> = name.toCharArray().toMutableSet()
    if (chars.count() %2 == 0) {
        print("CHAT WITH HER!")
    } else {
        print("IGNORE HIM!")
    }
}

fun main() = readLine()!!.let(String::toHashSet).run { size % 2 == 0 }.let { isGirl -> if (isGirl) "CHAT WITH HER!" else "IGNORE HIM!" }.run(::println)

fun main(args: Array<String>) {
    val str = readLine()!!
    (str.toCharArray().distinct().size % 2 == 0).sheOrHe()
            .also { println(it) }
}

private fun Boolean.sheOrHe() = if (this) "CHAT WITH HER!" else "IGNORE HIM!"

fun main(args: Array<String>) {
        readLine()!!.let {
            println(if (it.toSet().size.rem(2) == 0) "CHAT WITH HER!" else "IGNORE HIM!")
        }
    }

import java.util.Scanner;
import java.util.Arrays;
import java.util.*;
import java.math.*;
import java.io.*;

fun main(args: Array<String>) {
    var s = Scanner(System.`in`)
    var word = s.next()
    if(Distinct(word)% 2 == 0){
       print("CHAT WITH HER!")
    }else{
        print("IGNORE HIM!")
    }

}

fun Distinct(str:String):Int{

    val distinct = LinkedHashSet<Char>()
    val builder = StringBuilder()
    for(i in 0 .. str.length-1){
        if(distinct.add(str.get(i))){
            builder.append(str.get(i))
        }
    }
    return builder.length
}

fun main(args: Array<String>) {
val s = readLine()!!
var c =  ""
 for(item in s){
if(!c.contains(item)){
c+=item
}

 }
var x = c.length
when {
    x%2 != 0 -> print("IGNORE HIM!")
     else -> print("CHAT WITH HER!")

}

 }

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val reader = Reader()
    val string = reader.next()
    val set = hashSetOf<Char>()
    for (i in 0 until string.length) {
        set.add(string.elementAt(i))
    }
    println(if (set.count() % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

internal class Reader {
    var br: BufferedReader
    var st: StringTokenizer? = null

    init {
        br = BufferedReader(InputStreamReader(System.`in`))
    }

    operator fun next(): String {
        while (st == null || !st!!.hasMoreElements()) {
            try {
                st = StringTokenizer(br.readLine())
            } catch (e: IOException) {
                e.printStackTrace()
            }

        }
        return st!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }

    fun nextLine(): String {
        var str = ""
        try {
            str = br.readLine()
        } catch (e: IOException) {
            e.printStackTrace()
        }

        return str
    }
}

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

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val input = InputReader(inputStream)
    val output = PrintWriter(outputStream)
    val solver = Task()
    solver.solve(input, output)
    output.close()
}

private class Task {
    fun solve(input: InputReader, output: PrintWriter) {
        output.print(if (input.next().toSet().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

private class InputReader(stream: InputStream) {
    private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }
}

/* https://codeforces.com/problemset/problem/236/A */

fun main() {
    val name = readLine()!!
    val numOfDistinctChars = name.toSet().size
    if (numOfDistinctChars % 2 == 1) {
        println("IGNORE HIM!")
    } else {
        println("CHAT WITH HER!")
    }
}

import java.io.BufferedReader
import java.io.InputStreamReader
import java.lang.StringBuilder

fun main(){
    var chars :Set<Char> = BufferedReader(InputStreamReader(System.`in`)).readLine().toCharArray().toSet()
    println(if (chars.size % 2 == 0)"CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    var s = readLine()
    var l = arrayListOf<String>()
    for (i in s!!){
        l.add(i.toString())
    }
    if (l.toSet().size%2==1){
        println("IGNORE HIM!")
    }else{
        println("CHAT WITH HER!")
    }
}

import java.util.*
    fun main()
    {
        var str = readLine();
        val hash: MutableMap<Char, Char> = HashMap()
        for (i in 0 until str!!.length)
        {
            hash[str!![i]] = str[i]
        }
        if (hash.size % 2 == 0)
        {
            println("CHAT WITH HER!")
        }
        else
        {
            println("IGNORE HIM!")
        }
    }

import java.util.*

    fun main(args: Array<String>)
    {
        val `in` = Scanner(System.`in`)
        val str = `in`.nextLine()
        val hash: MutableMap<Char, Char> = HashMap()
        for (i in 0 until str.length)
        {
            hash[str[i]] = str[i]
        }
        if (hash.size % 2 == 0)
        {
            println("CHAT WITH HER!")
        }
        else
        {
            println("IGNORE HIM!")
        }
    }

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    val username = readLn().toSet()

    if (username.size % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

import java.util.*

fun main(args: Array<String>) {
    val s: Scanner = Scanner(System.`in`)
    val str: String = s.next()
    val set = str.toHashSet()
    print(if (set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {

    print(if (readLine()!!.toCharArray().distinct().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    reader.use {
        var el = it.readLine().toSet()
        print(if (el.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
    }
}

import java.util.Scanner

private const val CHAT_WITH_HER = "CHAT WITH HER!"
private const val IGNORE_HIM = "IGNORE HIM!"
private const val OFFSET = 'a'
private const val LATIN_ALPHABET_LENGTH = 26
private val BUCKET = IntArray(LATIN_ALPHABET_LENGTH)

fun main(args: Array<String>) {
    Scanner(System.`in`).use {
        val answer = determineGender(it.next())
        clearBucket()
        println(answer)
    }
}

private fun determineGender(nickname: String): String {
    return if (uniqueCharactersCount(nickname).isEven()) {
        CHAT_WITH_HER
    } else {
        IGNORE_HIM
    }
}

private fun uniqueCharactersCount(word: String): Int {
    var uniqueCount = 0
    val charsCount = word.length
    for (i in 0 until charsCount) {
        val index = word[i] - OFFSET
        if (BUCKET[index] == 0) {
            ++uniqueCount
            BUCKET[index] = 1
        }
    }
    return uniqueCount
}

private fun clearBucket() {
    for (i in 0 until LATIN_ALPHABET_LENGTH) {
        BUCKET[i] = 0
    }
}

private fun Int.isEven() = this % 2 == 0

fun main(args: Array<String>) {
    val s = readLine()!!
    val m = s.groupingBy { it }.eachCount().size
    println(if (m % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")

}

fun main(args: Array<String>) {
    val userName = readLine()!!
    val singleSet = mutableSetOf<Char>()
    userName.forEach{ char->
        singleSet.add(char)
    }
    println(if(singleSet.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

// codeforces problem 236 A

fun main() {
    println( if (readLine()!!.groupBy { it }.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args:Array<String>){val a=hashSetOf<Char>();for(z in readLine()!!.toList())a.add(z);print("${if(a.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")}

//1.2 | CodeForces.Com
fun main(args: Array<String>)
{
    val distinctChars = hashSetOf<Char>() //Abbreviation: Distinct characters

    for(input in readLine()!!.toList())
        distinctChars.add(input)

    print("${if (distinctChars.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"}")
}

//rextester.com:1.1--codeforces.com:1.0.5-2
fun main(args:Array<String>){
    val b=hashSetOf<Char>();for(c in readLine()!!.toList())if(!b.contains(c))b.add(c)
    print("${if(b.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")
}

import java.lang.AssertionError

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

private fun myAssert(x: Boolean) {
    if (!x) {
        throw AssertionError()
    }
}

fun main(args: Array<String>) {
  var s = readLn()
  var x = mutableSetOf<Char>()
  for (c in s) {
    x.add(c)
  }
  if (x.size % 2 == 0) {
    println("CHAT WITH HER!")
  } else {
    println("IGNORE HIM!")
  }
}

fun main(args: Array<String>) {
  println(if (readLine()!!.toCharArray().toSet().size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

//rextester.com:1.1--codeforces.com:1.0.5-2
fun main(args:Array<String>){
    val a=readLine()!!.toList()
    val b=hashSetOf<Char>();for(c in a)if(!b.contains(c))b.add(c)
    print("${if(b.size%2==0)"CHAT WITH HER!" else "IGNORE HIM!"}")
}

import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

/**
 * Created by Hamza on 17/02/2018.
 */
fun main(args: Array<String>) {
    var br = BufferedReader(InputStreamReader(System.`in`))
    var st = StringTokenizer(br.readLine())
    var str = st!!.nextToken()
    var l = str.length
    var count = IntArray(26)
    for (i in 0..l - 1) {
        count[str[i].toInt() - 'a'.toInt()]++
    }
    var countor = 0
    for (i in 0..25) {
        if (count[i] != 0) {
            countor++
        }
    }
if (countor%2 == 0) println("CHAT WITH HER!")else println("IGNORE HIM!")
}

fun main(){
    var s = readLine()!!
    var a = arrayOf("q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m")
    var k = ""
   for (i in 0..25){
       for (j in 0..s.length -1){
           if (a[i].compareTo(s[j].toString()) == 0){
               k = k + a.get(i)
               break
           }
       }
   }
   if ((k.length) % 2 == 0) println("CHAT WITH HER!") else println("IGNORE HIM!")
}

fun main() {
        val v = readLine()!!.toCharArray().distinct().size % 2 != 0
        println(if (v) "IGNORE HIM!" else "CHAT WITH HER!")
    }

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val name = reader.readLine()
    val set = setOf(*name.toCharArray().toTypedArray())
    val output = if (set.size % 2 != 0) "IGNORE HIM!" else "CHAT WITH HER!"
    println(output)
}

fun main(args : Array<String>) {
    var name = readLine()!!
    var s = name[0].toString()
    var dif = true
    for (i in  1..(name.length-1)){
        dif = true
        for (j in 0..(s.length-1)){
            if (name[i] == s[j])
                dif = false
        }
        if(dif)
            s += name[i]
    }
    if (s.length % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

fun main() {
    val s = readLine()!!
    if (s.toSet().size % 2 == 1) {
        println("IGNORE HIM!")
    } else {
        println("CHAT WITH HER!")
    }
}

import java.util.*
fun main(args: Array<String>) {
    val input = Scanner(System.`in`).nextLine()
    val count = input.chars().distinct().count().toInt()
    if (count % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }

}

fun main(args: Array<String>) {
    print(
        if (readLine()!!.toSet().size % 2 == 0)
            "CHAT WITH HER!"
        else
            "IGNORE HIM!"
    )
}

fun main() {

    val userName = readLine()!!
    val myList = ArrayList<Char>()

    userName.forEach {
        if(!myList.contains(it)){
            myList.add(it)
        }
    }

    if(myList.size%2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

fun main(args: Array<String>) {
    var chat = readLine()!!.toSet().size % 2 == 0
    println(if (chat) "CHAT WITH HER!" else "IGNORE HIM!")
}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

const val success = "CHAT WITH HER!"
const val failure = "IGNORE HIM!"

fun main() {
    val username = readLn()

    if (username.toList().distinct().size % 2 == 0) println(success) else println(failure)
}

fun main() {
    val s = readLine()!!.toCharArray().toMutableSet()
    if(s.size % 2 == 1)
        println("IGNORE HIM!")
    else
        println("CHAT WITH HER!")
}

fun main() {
    println(if (hashSetOf<Char>().apply { addAll(readLine()!!.toList()) }.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    val s = readLine()!!
    val arr = Array<Char>(s.length, { i -> s[i]})
    arr.sort()
    var cnt = 0
    for (i in arr.indices) {
        if (i == 0) {
            cnt++
        } else if (i > 0 && arr[i] != arr[i-1]) {
            cnt++
        }
    }
    if (cnt % 2 == 0) {
        print("CHAT WITH HER!\n")
    } else {
        print("IGNORE HIM!\n")
    }
}

//package problem236A

fun numDistinctCharacters(username: String): Int {
    val letterMap = hashMapOf<Char, Int>()

    for (char in username) {
        letterMap[char] = (letterMap[char] ?: 0) + 1
    }
    return letterMap.size
}

fun main() {
    val input = readLine()!!
    println(if (numDistinctCharacters(input) % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun readLn() = readLine()!! // string line
fun readInt() = readLn().toInt() // single int
fun readStrings() = readLn().split(" ") // list of strings
fun readInts() = readStrings().map { it.toInt() } // list of ints

fun boyOrGirl(): String {

    val usrname = readLn().toSet()

    return if (usrname.size % 2 == 0)
        "CHAT WITH HER!"
    else "IGNORE HIM!"
}

fun main() {
    print(boyOrGirl())
}

import java.util.*

fun main()
{
    var scanner = Scanner(System.`in`)
    var str = scanner.next()
    var flag = true
    var counter = 0
    var visited = mutableMapOf<Char , Boolean>()
    for(i in 0 until str.length)
    {
        if(visited[str[i]]==null)
        {
            visited[str[i]] = true
            counter++
        }
    }
    if(counter % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")

}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main() {
    val name = readLn()
    when (name.toCharArray().distinct().size % 2) {
        0 -> println("CHAT WITH HER!")
        else -> println("IGNORE HIM!")
    }
}

fun main(args: Array<String>)
{
    val s = readLine()!!
    val a = Array(26, {0})
    for (c in s)
        a[c - 'a'] = 1
    val diff = a.count({i -> i > 0})
    println(if (diff % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    if(checkGender(readLine().toString())) {
        println("CHAT WITH HER!")
    }
    else {
        println("IGNORE HIM!")
    }
}
fun checkGender(hello:String):Boolean {
        val map: HashMap<Char, Int> = HashMap()
        for(c in hello){
            if(!map.containsKey(c)){
                map[c] = 1
            }
        }
        return map.size%2==0
    }

fun main() {
    if (readLine()!!.toSet().size % 2 == 1) {
        println("IGNORE HIM!")
    }
    else{
        println("CHAT WITH HER!")
    }
}

fun main(args: Array<String>) {
    val name = readLine()!!

    if (name.toSet().count().rem(2) == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

fun main() {
    val name: String? = readLine()
    val charSet: MutableSet<Char> = mutableSetOf()

    // covert string to char
    name!!.forEach { index ->  charSet.add(index)}

    if (charSet.size % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

import java.util.*

fun main(args: Array<String>){
    val scan = Scanner(System.`in`)
    val s = scan.next().toCharArray()
    var count = 0

    for (i in 0 until s.size){
        for (x in i+1 until s.size){
            if (s[i] == s[x]) s[x] = ' '
        }
        if (s[i] != ' ') count++
    }
    if (count%2 == 0) print("CHAT WITH HER!")
    else print("IGNORE HIM!")
}

typealias int = Int

fun main() {
    var s1 = readLine()
    var set : MutableSet<Char> = mutableSetOf();
    for(i in 0..s1!!.lastIndex){
        set.add(s1[i])
    }
    println(if(set.size % 2== 0 ) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main() {
    var chars = readLine()!!.toCharArray()
    var set : Set<Char> = chars.toSet()
    println(if(set.size % 2== 0 ) "CHAT WITH HER!" else "IGNORE HIM!")
}

//package codeforces

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val In = BufferedReader(InputStreamReader(System.`in`))
    val name = In.readLine()!!.toSet()
    if(name.size % 2 ==0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}

import java.util.Scanner

fun main(){
    var input = Scanner(System.`in`)
    var s = input.next()
    var length = removeDistincts(s).length
    if(length % 2 == 0)
        println("CHAT WITH HER!")
    else
        println("IGNORE HIM!")
}
fun removeDistincts(str : String) : String {

    var charArr = str.toCharArray()
    var arr = arrayListOf<Char>()
    for (i in 0..charArr.size-1){
        arr.add(charArr.get(i))
    }
    var i = 0
    var j = 1
    while (i < arr.size-1){
        j = i +1
        while (j < arr.size) {
            if (arr.get(i) == arr.get(j)) {
                arr.removeAt(j)
            } else
                j++
        }
        i++
    }
    return arr.toString()

}

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readDouble() = readLn().toDouble() // single double
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of longs
private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles

fun main() {
	val str = readLn()

	if (str.toSet().size % 2 == 0)
		println("CHAT WITH HER!")
	else
		println("IGNORE HIM!")
}

import java.util.*

fun main() {
    val scanner = Scanner(System.`in`)
    val username = scanner.next().toSet()

    if (username.size % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

fun main() {
    val data = readLine()!!.map { it.toString() }.sorted()

    val unique = data.reduce { acc, s ->
        if (acc.last().toString() == s) acc else acc + s
    }.length
    if (unique % 2 == 0) {
        println("CHAT WITH HER!")
    } else {
        println("IGNORE HIM!")
    }
}

fun main(args: Array<String>) {
	val userInput: String? = readLine()
	val user = userInput!!
	println(checkIfMale(user))
}

fun checkIfMale(user: String): String {
	val listOfChars = user.toList();
	val set = hashSetOf<Char>()
	for(char in listOfChars){
		if(!set.contains(char)){
			set.add(char)
		}
	}

	return if(set.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!"
}

/**
 *
 * Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a
 * user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so).
 * After that they talked very often and eventually they became a couple in the network.
 *
 * But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is
 * very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.
 *
 * This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she
 * is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.
 *
 * Input
 * The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters.
 *
 * Output
 * If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes).
 */
fun main(){
    val input = readLine()
    val listChar = mutableListOf<String>()
    input!!.forEach {
        if(!listChar.contains(it.toString())){
            listChar += it.toString()
        }
    }
    if(listChar.size and 1 == 0){
        // the number of distinct chars is even
        println("CHAT WITH HER!")
    }
    else{
        // the number of distinct chars is odd
        println("IGNORE HIM!")
    }
}

fun main() {
    val username = readLine()!!.toCharArray()
    val distinctChars = username.distinct()
    print(if(distinctChars.size % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM!")
}

fun main(args: Array<String>) {
    if(checkGender(readLine().toString())) {
        println("CHAT WITH HER")
    }
    else {
        println("IGNORE HIM")
    }
}
fun checkGender(hello:String):Boolean {
        val map: HashMap<Char, Int> = HashMap()
        for(c in hello){
            if(!map.containsKey(c)){
                map[c] = 1
            }
        }
        return map.size%2==0
    }

//package codeforces

import java.io.BufferedReader
import java.io.InputStreamReader

fun main() {
    val In = BufferedReader(InputStreamReader(System.`in`))
    val name = In.readLine()!!.toSet()
    if(name.size % 2 ==0)
        println("IGNORE HIM!")
    else
        println("CHAT WITH HER!")
}

fun main(){
    val s = readLine()!!
    var repeat = 0
    for (i in 0..s.length-1){
        for (j in (i+1)..s.length -1) {
            if (s[i].compareTo(s[j]) == 0) repeat++
        }
    }
    if ((s.length - repeat) % 2 == 0) println("CHAT WITH HER!") else println("IGNORE HIM!")
}

import java.io.BufferedReader
import java.io.InputStreamReader

fun main(args: Array<String>) {
    val reader = BufferedReader(InputStreamReader(System.`in`))
    val result = reader.readLine().length % 2 == 0
    println(if (result) "IGNORE HIM!" else "CHAT WITH HER!")
}

fun main(args: Array<String>) {
    val count = readLine()!!.toSet().size
    println(if (count % 2 == 0) "CHAT WITH HER!" else "IGNORE HIM")
}

fun main(){
    val input = readLine()
    val listChar = mutableListOf<String>()
    input!!.forEach {
        if(!listChar.contains(it.toString())){
            listChar += it.toString()
        }
    }
    if(listChar.size and 1 == 0){
        // the number of distinct chars is even
        println("IGNORE HIM!")
    }
    else{
        // the number of distinct chars is odd
        println("CHAT WITH HER!")
    }
}


fun main() {
    var n = readLine()!!.toInt()
    var list = readLine()!!.split(' ').map { it.toInt() }.sum()
    var ans = 0
    for (i in 1..5) {
        if ((list + i) % (n + 1) != 1) {
            ans++
        }
    }
    println(ans)
}

import java.util.*

val reader = Scanner(System.`in`)
var c = 0
var ans = 0
fun main(args: Array<String>) {
    val n = reader.nextInt()
    for (i in 1..n)
        c+=reader.nextInt()
    for (i in 1..5)
    {
        if ((i+c)%(n+1) !=1)
            ans++
    }
    /*if ((c+1)%(n+1)==1)
        println(2)
    else
        println(3)*/
    println(ans)
}

fun main(args: Array<String>) {

    var n = readLine()!!.toLong()
    n++

    var sum = 0L
    var res = 0L

    readLine()!!.split(' ').map { sum += it.toLong() }

    sum--;

    for (i in 1..5) {
        if ((sum + i) % n != 0L) res++
    }

    print(res)

}

fun main() {
    var n = readLine()!!.toInt() + 1
    val total = readLine()!!.split(" ").map{ it.toInt() }.reduce{ sum, e -> sum + e }
    var count = 0
    for(i in 1..5) {
        if((i + total) % n != 1)
            count++
    }
    println(count)
}

import java.util.*

val reader = Scanner(System.`in`)
var c = 0
fun main(args: Array<String>) {
    val n = reader.nextInt()
    for (i in 1..n)
        c+=reader.nextInt()
    if ((c+1)%(n+1)==1)
        println(2)
    else
        println(3)
}

fun main() {
    var n = readLine()!!.toInt()
    var list = readLine()!!.split(' ').map { it.toInt() }.sum()
    var ans = 0
    for (i in 1..5) {
        if ((list + i) % (n + 1) != 1) {
            ans = i
            break
        }
    }
    println(ans)
}