### ROBLEM LINKS

### DIFFICULTY

EASY

### EXPLANATION

There are 3^{N} numbers which are **N** digits integers and contain only the digits 3, 5 and 8. And there are no less than 3^{N} / 6 Ciel numbers with **N** digits. Because, for example, let **a, b, c** be distinct nonnegative integers. Then the all following number are equal.

The number of integers **k** satisfying **f(k**, 3) = **a**, **f(k**, 5) = **b**, **f(k**, 8) = **c**

The number of integers **k** satisfying **f(k**, 3) = **a**, **f(k**, 5) = **c**, **f(k**, 8) = **b**

The number of integers **k** satisfying **f(k**, 3) = **b**, **f(k**, 5) = **a**, **f(k**, 8) = **c**

The number of integers **k** satisfying **f(k**, 3) = **b**, **f(k**, 5) = **c**, **f(k**, 8) = **a**

The number of integers **k** satisfying **f(k**, 3) = **c**, **f(k**, 5) = **a**, **f(k**, 8) = **b**

The number of integers **k** satisfying **f(k**, 3) = **c**, **f(k**, 5) = **b**, **f(k**, 8) = **a**

And all integers in one group are Ciel numbers. In this case the ratio of Ciel numbers are 1/6. If **a**, **b**, **c** are not distinct, the ratio of Ciel numbers are more than 1/6. Check it by yourself:)

Therefore the 50000th Ciel number fits signed 64 bit integer type. And it works in this problem that simply checking whether each number containing only the digits 3, 5, 8 is a Ciel number or not. The number of the integers that we should check is no more than 6 * 50000.

### SETTERâ€™S SOLUTION

Can be found here.

### TESTERâ€™S SOLUTION

Can be found here.