while 1:print sum(map(int,str(4**input())))