ABCLOG - Time to get a job

no tags 

ABC Pvt. Ltd., needs to recruit some candidates and they want the test to be somewhat new, rather than the conventional way of asking questions in all areas. They have a logic, which converts one integer to another. Your task is to find the logic behind it and then solve the questions for certain inputs.

The question given by them is as follows:

The following are the output provided for the inputs given to one of our newly bought machines. You need to find the output that will be generated for the given inputs. Some sample input and output are:

   4 -> 1, 23 -> 29, 7 -> 7  16 -> 1

 

Your task is to find the machine's output for some inputs

Input

Input contains several integers, each in a single line.

Input ends with a -1

All inputs <= 10^16

Output

Output one integer for every input, as said above.

Example

Input:
4
7
23
-1

 Output: 1
7
29

hide comments
Saransh Sharma: 2013-12-30 15:47:09

does input contains negative integers also?

Abhishek Gupta: 2013-12-30 11:30:50

AC in first attempt... :)

Nikhil Dhaka: 2013-12-29 21:12:50

damn easy... :)

Stefan Majoor: 2013-12-29 20:12:37

Got a lot of WA's because I suck at using scanf

ben: 2013-12-29 10:57:34

50th prob ... :)

Ashwini: 2013-12-28 16:01:28

ac in first attempt....:)

Manu Narsaria: 2013-12-28 07:15:58

the inputs are smaller compared to constraints... think simple...

Prakhar Gupta: 2013-12-27 17:34:36

Last edit: 2014-01-01 19:39:45
kk: 2013-12-26 21:52:35

think like coder

Hasil Sharma: 2013-12-26 18:42:46

Easy one, back to basics of computer programming :) ;)


Added by:Aswin Murugesh
Date:2013-12-21
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem