Given an integer, we need to find the super digit of the integer.
We define super digit of an integer using the following rules:
- If has only digit, then its super digit is .
- Otherwise, the super digit of is equal to the super digit of the digit-sum of . Here, digit-sum of a number is defined as the sum of its digits.
For example, super digit of will be calculated as:
super_digit(9875) = super_digit(9+8+7+5)
You are given two numbers and . You have to calculate the super digit of .
is created when number is concatenated times. That is, if and , then .