Unusual Multiplication

All submissions for this problem are available.
Multiplying two natural numbers is really a clumsy operation. However, sometimes we can get the answer by moving the last digit to the front
For example: 179487 * 4 = 717948
This property obviously depends on the number system you are using, the above being decimal number system.In base 9 we can have:
17 * 4 = 71 (base 9)
as (9 * 1 + 7) * 4 = 7 * 9 + 1
NOTE: ALL NUMBERS IN THIS PROBLEM ARE NOT DECIMAL NUMBERS
Input
The input given is a textfile which will end with the standard endoffile marker. Each line of the textfile has 3 numbers (separated by a space) : The base for the number system, the least significant digit of the first factor, and the second factor. This second factor is one digit only hence less than the base.
Output
Your job is to find out for each input line the number of digits of the smallest first factor with the rotamultproperty. The outputfile is also a textfile. Each line contains the answer for the corresponding input line.
Sample Input
10 7 4 9 7 4 17 14 12
Sample Output
6 2 4
Author:  dhwanitquark 
Tags  dhwanitquark 
Date Added:  4022016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 