# a,m,d,n=map(int,input().split())
# a=int(a)
# m=int(m)
# d=int(d)
# n=int(n)
# for i in range(1,n):
# a=a*m+d
# print(a)
# a,b,c=input().split()
# a=int(a)
# b=int(b)
# c=int(c)
# d=1
# while d%a!=0 or d%b!=0 or d%c!=0:
# d+=1
# print(d)
# n=int(input())
# a=input().split()
# for i in range(n):
# a[i]=int(a[i])
# d=[]
# for i in range(24):
# d.append(0)
# for i in range(n):
# d[a[i]]+=1
# for i in range(1,24):
# print(d[i],end=' ')
# n=int(input())
# a=input().split()
# for i in range(n-1, -1, -1):
# print(a[i], end=' ')
# n = int(input())
# k = list(map(int,input().split()))
# a=k[0]
# for i in range(n):
# if(a>k[i]):
# a=k[i]
# print(a)
# d=[]
# for i in range(20):
# d.append([])
# for j in range(20):
# d[i].append(0)
#
# n=int(input())
# for i in range(n):
# x,y=input().split()
# d[int(x)][int(y)]=1
#
# for i in range(1,20):
# for j in range(1,20):
# print(d[i][j], end=' ')
# print()
# n=int(input())
# s=0
# c=0
# while True:
# s+=c
# c+=1
# if s>=n:
# break
# print(s)