#!/usr/bin/env tclsh

set nums [split [read stdin] \n]
set n [llength $nums]

for {set i 0} {$i < $n - 2} {incr i} {
  for {set j [expr {$i+1}]} {$j < $n - 1} {incr j} {
    for {set k [expr {$j+1}]} {$k < $n} {incr k} {
      set a [lindex $nums $i]
      if {$a eq ""} continue
      set b [lindex $nums $j]
      if {$b eq ""} continue
      set c [lindex $nums $k]
      if {$c eq ""} continue
      if {$a + $b + $c == 2020} {puts "$a $b $c [expr {$a * $b * $c}]"; exit}
    }
  }
}