Smallest 13-5-number

Write a program that provided a sequence of numbers prints the smallest one that is multiple of 1313 and has digit 5 —digit 5 appears at least once in the (base 10) representation of the number —.

Input

The input has one or more cases. Each case consists of a sequence of naturals (integers greater than zero) finished with number zero.

Output

For each case, the program has to print in a line the smallest number in the sequence that is a multiple of 13 and has the digit 5. If there is no such a number, the program has to write no one.

Problem information

Author: ProAl

Generation: 2026-01-25T14:20:46.004Z

© Jutge.org, 2006–2026.
https://jutge.org