def Digit(n):
    arr = []
    square = []
    t=n
    while int(n):
        t =n % 10
        arr.append(t)
        n = int(n/10)
    return arr
def s(n):
    a = Digit(n**2)
    b = Digit(n)
    print("%d %d"%(sum(b),sum(a)))
        
    

while True:
    try:
        n = int(input())
        s(n)
    except:
        break