
def superDigit(n, k):
    p = create_p(n, k)
    return get_super_digit(p)

def get_super_digit(p):
    if len(p) == 1:
        return int(p)
    else:
        digits = map(int, list(p))
        return get_super_digit(str(sum(digits)))

def create_p(n, k):
    return n * k

if __name__ == '__main__':
    nk = input().split()
    n = nk[0]
    k = int(nk[1])
    result = superDigit(n, k)
    print(result)


def super_digit(n, k):
    digits = map(int, list(n))
    return get_super_digit(str(sum(digits) * k))

def get_super_digit(p):
    if len(p) == 1:
        return int(p)
    else:
        digits = map(int, list(p))
        return get_super_digit(str(sum(digits)))

if __name__ == '__main__':
    nk = input().split()
    n = nk[0]
    k = int(nk[1])
    result = super_digit(n, k)
    print(result)

Implement shortcut to compute initial p super digit
Implement shortcut to compute initial p super digit

  
- def superDigit(n, k):
+ def super_digit(n, k):
-     p = create_p(n, k)
-     return get_super_digit(p)
+     digits = map(int, list(n))
+     return get_super_digit(str(sum(digits) * k))
  
  def get_super_digit(p):
      if len(p) == 1:
          return int(p)
      else:
          digits = map(int, list(p))
          return get_super_digit(str(sum(digits)))
  
- def create_p(n, k):
-     return n * k
- 
  if __name__ == '__main__':
      nk = input().split()
      n = nk[0]
      k = int(nk[1])
-     result = superDigit(n, k)
+     result = super_digit(n, k)
      print(result)
  
Implement shortcut to compute initial p super digit
## Code Before:

def superDigit(n, k):
    p = create_p(n, k)
    return get_super_digit(p)

def get_super_digit(p):
    if len(p) == 1:
        return int(p)
    else:
        digits = map(int, list(p))
        return get_super_digit(str(sum(digits)))

def create_p(n, k):
    return n * k

if __name__ == '__main__':
    nk = input().split()
    n = nk[0]
    k = int(nk[1])
    result = superDigit(n, k)
    print(result)

## Instruction:
Implement shortcut to compute initial p super digit
## Code After:

def super_digit(n, k):
    digits = map(int, list(n))
    return get_super_digit(str(sum(digits) * k))

def get_super_digit(p):
    if len(p) == 1:
        return int(p)
    else:
        digits = map(int, list(p))
        return get_super_digit(str(sum(digits)))

if __name__ == '__main__':
    nk = input().split()
    n = nk[0]
    k = int(nk[1])
    result = super_digit(n, k)
    print(result)
