শূন্য এবং অঙ্ক গণনা ( How Many Zeroes and How Many Digits )

CPU: 1s
Memory: 1024MB


তোমাকে বের করতে হবে যে একটি b ভিত্তিক নম্বর সিস্টেম এ একটি দশমিক সংখ্যা n এর ফ্যাক্টরিয়াল এ কতগুলো ডানদিক ঘেষা শূন্য (trailing zero) এবং কতগুলো অঙ্ক থাকবে। যেমন ৫! (factorial 5) এর মান দশমিক নম্বর-সিস্টেম এ ১২০ (১৫) কিন্তু ষোলো-ভিত্তিক (hexadecimal) নম্বর সিস্টেম এ ৭৮ । তাই দশমিক নম্বর-সিস্টেম এ ৫! এ একটি ডানদিক ঘেষা শূন্য (trailing zero) এবং তিনটি অঙ্ক আছে এবং ষোলো ভিত্তিক (hexadecimal) নম্বর সিস্টেম এ শূন্যটি ডানদিক ঘেষা শূন্য এবং দুইটি অঙ্ক আছে। তুমি এটা ধরে নিতে পার যে b -ভিত্তিক নম্বর-সিস্টেম এর ০ থেকে b -১ মানের ডিজিট গুলোর প্রতিটির জন্য পৃথক চিহ্ন আছে।

Given a decimal integer number you will have to find out how many trailing zeros will be there in its factorial in a given number system and also you will have to find how many digits will its factorial have in a given number system? For example, the value of 5! in decimal and hexadecimal number system is 120 and 78 respectively. So in decimal number system it has 1 one trailing zero and three digits and in hexadecimal number system it has zero trailing zeroes and two digits. You can assume that for a b based number system there are b different symbols to denote digits ranging from 0 ... b-1.


ইনপুটের বর্ণনা

ইনপুট নথি (ফাইল) তে বেশ কিছু লাইন ইনপুট থাকবে। একেকটি লাইন একেকটি ইনপুট সেট কে ধারণ করে। প্রতি লাইন এ থাকবে একটি দশমিক নম্বর N (একটি অঋণাত্মক ২০-বিটের নম্বর) ও একটি দশমিক নম্বর B (১


Input Specification

There will be several lines of input. Each line makes a block. Each line will contain a decimal number N (a 20-bit unsigned number) and a decimal number B (1


আউটপুট এর বর্ণনা

প্রতি লাইন ইনপুট এর জন্য এক লাইন আউটপুট দিতে হবে। এই লাইন এ দুটি পূর্ণ সংখ্যা থাকবে যার প্রথমটি N! এ কতগুলো ডানদিক ঘেষা শূন্য (trailing zero) আছে এবং দ্বিতীয়টি N! এ কতগুলো অঙ্ক আছে তা নির্দেশ করবে (এগুলো অবশ্যই b -ভিত্তিক নম্বর সিস্টেম এর জন্য) । এই দুটি পূর্ণ সংখ্যা এর মাঝে একটি স্পেস থাকবে। এটা তুমি নিশ্চিত ভাবেই ধরে নিতে পার যে ডানদিক ঘেষা শূন্য (trailing zero) এবং অঙ্কের সংখ্যা কখনো ২^৩১-১ এর চেয়ে বেশি হবেনা।


Output Specification

For each line of input output in a single line how many trailing zeros will the factorial of that number have in the given number system and also how many digits will the factorial of that number have in that given number system. Separate these two numbers with a single space. You can be sure that the number of trailing zeros or the number of digits will not be greater than 2^31-1


Sample

InputOutput
2 10 5 16 5 100 1 0 2 1 3

Problemsetter: Shahriar Manzoor