McCarthy is a famous theorician of computer science. In his work, he defined a recursive function, called f91, that takes as input a positive integer N and returns a positive integer defined as follows:
Write a program, that computes McCarthy's f91.
The input tests will consist of a series of positive integers, each integer is at most 1,000,000. There will be at most 250,000 test cases. Each number is on a line on its own. The end of the input is reached when the number '0' is met. The number '0' shall not be considered as part of the test set.
The program shall output each result on a line by its own, following the format given in the sample output.
範例輸入 1
500 91 0
範例輸出 1
f91(500) = 490 f91(91) = 91
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.