eolymp
bolt
Try our new interface for solving problems
Problems

Digits

Digits

Time limit 1 second
Memory limit 64 MiB

A positive integer which is equal to C^n, where С = 1..9 contains at least K numbers C. For given numbers C and K find the smallest value of N.

Input data

In the input file contains two numbers С and K, K500.

Output data

One number N.

Examples

Input example #1
9 2
Output example #1
5
Author Zhukovsky S.S.
Source Stage III All-Ukrainian School Olympiad 2010-2011, Round 2, Zhytomyr