func scanf()->String?{
let fileHandle = NSFileHandle.init(fileDescriptor:STDIN_FILENO)
let data = fileHandle.availableData
let str = String.init(data: data,encoding:NSUTF8StringEncoding)
if str == nil{
return nil
}
return(str! as NSString).substringToIndex((str! as NSString).length - 1)as String
}
func changgeNum(num: Int)->Int{
var number = num
var count = 0
while number != 0{
count += 1
number /= 10
}
var flag = Int(pow(10,Doublt(count - 1)))
var shuzu = num
var sum = 0
for _ in 1...count{
sum += shuzu % 10 * flag
shuzu /= 10
flag /= 10
}
return sum
}
var s = Int(scanf()!)!
print(changgeNum(s))