num=int(input())
for i in range(num):
print('*'*(i+1)) # input숫자만큼 별 1개부터 줄별로 1개씩 추가 하며 별 넣기.
a, b, c, d, e = map(int, input().split())
lest = (a**2 + b**2 + c**2 + d**2 + e**2) % 10
print(lest) #갯수가 주어졌기 때문에 수월 하였으나 갯수가 안주어져 있다면 for문이 합리적임.
num=int(input())
for i in range(num):
print('*'*(i+1)) # input숫자만큼 별 1개부터 줄별로 1개씩 추가 하며 별 넣기.
a, b, c, d, e = map(int, input().split())
lest = (a**2 + b**2 + c**2 + d**2 + e**2) % 10
print(lest) #갯수가 주어졌기 때문에 수월 하였으나 갯수가 안주어져 있다면 for문이 합리적임.