Imagine that there is a group of three friends: A, B and С. A owes B 20 rubles and B owes C 20 rubles. The total sum of the debts is 40 rubles. You can see that the debts are not organized in a very optimal manner. Let's rearrange them like that: assume that A owes C 20 rubles and B doesn't owe anything to anybody. The debts still mean the same but the total sum of the debts now equals 20 rubles.

This task is a generalisation of a described example. Imagine that your group of friends has n people and you know the debts between the people. Optimize the given debts without changing their meaning. In other words, finally for each friend the difference between the total money he should give and the total money he should take must be the same. Print the minimum sum of all debts in the optimal rearrangement of the debts. See the notes to the test samples to better understand the problem.

Input

The first line contains two integers n and m (1 ≤ n ≤ 100; 0 ≤ m ≤ 104). The next m lines contain the debts. The i-th line contains three integers ai, bi, ci (1 ≤ ai, bi ≤ n; ai ≠ bi; 1 ≤ ci ≤ 100), which mean that person ai owes person bi ci rubles.

Assume that the people are numbered by integers from 1 to n.

It is guaranteed that the same pair of people occurs at most once in the input. The input doesn't simultaneously contain pair of people (x, y) and pair of people (y, x).

Output

Print a single integer — the minimum sum of debts in the optimal rearrangement.

Examples

Input

5 3
1 2 10
2 3 1
2 4 1


Output

10


Input

3 0


Output

0


Input

4 3
1 2 1
2 3 1
3 1 1


Output

0

Note

In the first sample, you can assume that person number 1 owes 8 rubles to person number 2, 1 ruble to person number 3 and 1 ruble to person number 4. He doesn't owe anybody else anything. In the end, the total debt equals 10.

In the second sample, there are no debts.

In the third sample, you can annul all the debts.
a,b= map(int, input().split())
c= [0]*a
for i in range(b):
    d, e, f = map(int, input().split())
    c[d-1] += f
# # import pywhatkit as a:
#
# import
#
# # def pow(a,b):
# #     if(b%2==0):
# #         return pow(a,b//2)*pow(a,b//2)
# #     else:
# #         return pow(a,b//2)*pow(a,b//2)*a
# #
# # print(pow(int(input()),int(input())))
# # # def pow(a,b):
# # #     if(b==0):
# # #         return 1
# # #     else:
# # #         return a*pow(a,b-1)
# # #
# # # print(pow(int(input()),int(input())))
# #
# #
# #
# # # def A(a):
# # #     if(a<1):
# # #         return
# # #     print(a)
# # #     A(a-1)
# # #     print(a)
# # # A(int(input()))
# #
# # # def fact(a):
# # #     if(a==1):
# # #         return a
# # #     else:
# # #         return a*fact(a-1)
# # # print(fact(int(input())))
# # # a=int(input())
# # # for j in range(a,0,-1):
# # #     print(j)
# # # for i in range(1,a+1):
# # #     print(i)
# # # def pd(a):
# # #     if(a==0):
# # #         return
# # #     print(a)
# # #     pd(a-1)
# # # pd(int(input()))
# #
# # # def pd(a):
# # #     if(a==0):
# # #         def pi(a):
# # #             if(a==0):
# # #                 return
# # #             pi(a-1)
# # #             print(a)
# # #     print(a)
# # #     pd(a-1)
# # #
# # # pd(int(input()))
# # #
# # #
# # # # def pi(a):
# # # #     if(a==0):
# # # #         return
# # # #     pi(a-1)
# # # #
# # # #     print(a)
# # # #
# # # # pi(int(input()))
# # #
# # # # # your code goes here
# # # # a=int(input())
# # # # b=0
# # # # for i in range(a):
# # # #     c=input()
# # # #     if('1' in c):
# # # #         b+=1
# # # #
# # # # print(b)
# # # #
# # # # # x,y,z=map(int,input())
# # # # # a=[]
# # # # # b=[]
# # # # # c=[]
# # # # # for i in range(x):
# # # # #
# # # # #     a.append(i)
# # # # #
# # # # #     b.append(j)
# # # # #
# # # # #     c.append(k)
# # # # #
# # # # #
# # # # #
# # # # # # a=int(input())
# # # # # #
# # # # # # for i in range(a):
# # # # # #     b=int(input())
# # # # # #     if(b<=30):
# # # # # #         print('NO')
# # # # # #         continue
# # # # # #     c=b-30
# # # # # #     if(b==36):
# # # # # #         print('Yes')
# # # # # #         print('5 6 15 10')
# # # # # #     elif(b==40):
# # # # # #         print('Yes')
# # # # # #         print('3 6 10 21')
# # # # # #     elif(b==44):
# # # # # #         print('YES')
# # # # # #         print('21 15 6 2')
# # # # # #
# # # # # #     elif c in [6,10,14]:
# # # # # #         print('NO')
# # # # # #     else:
# # # # # #         print('YES')
# # # # # #         print('6 10 14 {}'.format(b-30))
# # # # #
# # # # # # def pf(a):
# # # # # #     for i in range(1,a+1):
# # # # # #         b=[]
# # # # # #         if(a%i==0):
# # # # # #            b.append(i)
# # # # # #
# # # # # # def prime(b):
# # # # # #     for i in b:
# # # # # #         if i > 1:
# # # # # #         # check for factors
# # # # # #         for i in range(2,num):
# # # # # #             if (i % i) == 0:
# # # # # #                 print(num,"is not a prime number")
# # # # # #                 print(i,"times",num//i,"is",num)
# # # # # #                 break
# # # # # #         else:
# # # # # #             print(num,"is a prime number")
# # # # # #
# # # # # #         # if input number is less than
# # # # # #         # or equal to 1, it is not prime
# # # # # #         else:
# # # # # #         print(num,"is not a prime number")
# # # # # #
# # # # # #
# # # # # #
# # # # # # def no(a):
# # # # # #     for i in range(1,a):
# # # # # #         for j in range(i,a):
# # # # # #             for k in range(j,a):
# # # # # #                 for l in range(k,a):
# # # # # #                     if(i!=j!=k!=l):
# # # # # #                         if(i+j+k+l==a):
# # # # # #                             print(i,j,k,l)
# # # # # #
# # # # # # no(int(input()))
# # # # # #
# # # # # #
# # # # # # # n = int(input())
# # # # # # # s = input().upper()
# # # # # # # li = list(s)
# # # # # # #
# # # # # # # if len(s) != n:
# # # # # # #     raise ValueError
# # # # # # #
# # # # # # # count = 0
# # # # # # #
# # # # # # # for i in range(n - 1):
# # # # # # #     if ('BB' or 'RR' or 'GG') in ''.join(li[i:i+2]):
# # # # # # #         count += 1
# # # # # # #
# # # # # # # print(count)
# # # # # # #
# # # # # # #
# # # # # # # # from turtle import Turtle
# # # # # # # # t = Turtle()
# # # # # # # # t.speed(0)
# # # # # # # # #a = 180
# # # # # # # # b = 180
# # # # # # # # for c in range(5):
# # # # # # # #     a = 9*c
# # # # # # # #     for i in range(100):
# # # # # # # #         t.circle(i,a)
# # # # # # # #         t.right(b)
# # # # # # # #         t.circle(i,a)
# # # # # # # #         t.right(b)
# # # # # # # #         t.circle(i,a)
# # # # # # # #         t.right(b)
# # # # # # # #         t.circle(i,a)
# # # # # # # # input('Press any key to continue...')
# # # # # # # #
# # # # # # # # # def hcf(a,b):
# # # # # # # # #     if(b==0):
# # # # # # # # #         return a
# # # # # # # # #     else:
# # # # # # # # #         return hcf(b,a%b)
# # # # # # # # #
# # # # # # # # #
# # # # # # # # # def lcm(a,b):
# # # # # # # # #     return (a*b)//hcf(a,b)
# # # # # # # # #
# # # # # # # # # x=int(input())
# # # # # # # # # for i in range(x):
# # # # # # # # #     a,b=map(int,input().split())
# # # # # # # # #     for i in range(a,b+1):
# # # # # # # # #         for j in range(a+1,b+1):
# # # # # # # # #             if(lcm(i,j)*2<=r):
# # # # # # # # #                 print(lcm(i,j),lcm(i,j)*2)
# # # # # # # # #                 break
# # # # # # # # #         else:
# # # # # # # # #             print('-1 -1')
# # # # # # # # #         break
# # # # # # # # #
# # # # # # # # # # # Two separate lists
# # # # # # # # # # cars = ["Aston", "Audi", "McLaren"]
# # # # # # # # # # accessories = ["GPS kit", "Car repair-tool kit"]
# # # # # # # # # #
# # # # # # # # # # # Single dictionary holds prices of cars and
# # # # # # # # # # # its accessories.
# # # # # # # # # # # First three items store prices of cars and
# # # # # # # # # # # next two items store prices of accessories.
# # # # # # # # # # prices = {1:"570000$", 2:"68000$", 3:"450000$",
# # # # # # # # # #           4:"8900$", 5:"4500$"}
# # # # # # # # # #
# # # # # # # # # # # Printing prices of cars
# # # # # # # # # # for index, c in enumerate(cars, start=1):
# # # # # # # # # #     print ("Car: %s Price: %s"%(c, prices[index]))
# # # # # # # # # #
# # # # # # # # # # # Printing prices of accessories
# # # # # # # # # # for index, a in enumerate(accessories,start=1):
# # # # # # # # # #     print ("Accessory: %s Price: %s" \
# # # # # # # # # #            %(a,prices[index+len(cars)]))
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # #
# # # # # # # # # # # a=[1,2,3,4,5,6,7,8,9]
# # # # # # # # # # # b=0
# # # # # # # # # # # c=[]
# # # # # # # # # # # for i in a:
# # # # # # # # # # #     b+=i
# # # # # # # # # # #     c.append(b)
# # # # # # # # # # # print(c)
# # # # # # # # # # #
# # # # # # # # # # #
# # # # # # # # # # # # a=3.547498
# # # # # # # # # # # # print('%.5f'%a)
# # # # # # # # # # #
# # # # # # # # # # # # #input
# # # # # # # # # # # # a=list(map(int,input().split()))
# # # # # # # # # # # #
# # # # # # # # # # # # #output
# # # # # # # # # # # # for i in a:
# # # # # # # # # # # #     print(i)
# # # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # # try:
# # # # # # # # # # # # #     a=int(input())
# # # # # # # # # # # # #     for i in range(a):
# # # # # # # # # # # # #         b,c=map(int,input().split())
# # # # # # # # # # # # #         e=[]
# # # # # # # # # # # # #         d=list(map(int,input().split()))
# # # # # # # # # # # # #         for k in d:
# # # # # # # # # # # # #             if(k%c==0):
# # # # # # # # # # # # #                 e.append('1')
# # # # # # # # # # # # #             else:
# # # # # # # # # # # # #                 e.append('0')
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #     f=''.join(e)
# # # # # # # # # # # # #     print(str(f))
# # # # # # # # # # # # #
# # # # # # # # # # # # # except:
# # # # # # # # # # # # #     pass
# # # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # #
# # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # b=list(map(int,input().split()))
# # # # # # # # # # # # #
# # # # # # # # # # # # # c=set(b)
# # # # # # # # # # # # #
# # # # # # # # # # # # # c.remove(max(c))
# # # # # # # # # # # # # print(max(c))
# # # # # # # # # # # # # a=['rahul','ayush','ayush ki bndi',2,6,5,7]
# # # # # # # # # # # # # with open ('a.txt','w') as b:
# # # # # # # # # # # # #     for i in a:
# # # # # # # # # # # # #         print(i,file=b)
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # #
# # # # # # # # # # # # # # a,b=input()
# # # # # # # # # # # # # #
# # # # # # # # # # # # # # # try:
# # # # # # # # # # # # # # #     a=int(input())
# # # # # # # # # # # # # # #     for i in range(a):
# # # # # # # # # # # # # # #         b=int(input())
# # # # # # # # # # # # # # #         c=input()
# # # # # # # # # # # # # # #         d=set(c)
# # # # # # # # # # # # # # #         for j in d:
# # # # # # # # # # # # # # #             if(c.count(j)%2==0):
# # # # # # # # # # # # # # #                 b-=c.count(j)
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # #         if(b==0):
# # # # # # # # # # # # # # #             print('YES')
# # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # #             print('NO')
# # # # # # # # # # # # # # # except:
# # # # # # # # # # # # # # #     pass
# # # # # # # # # # # # # #
# # # # # # # # # # # # # #
# # # # # # # # # # # # # # # a={'rahul','ram','ayush','akansha','holi','lodaram'}
# # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # print(sorted(a))
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # while(a!=0):
# # # # # # # # # # # # # # # #     x=0
# # # # # # # # # # # # # # # #     y=[]
# # # # # # # # # # # # # # # #     l,r,m=map(int,input().split())
# # # # # # # # # # # # # # # #     for i in range(min(l,r),max(l,r)+1):
# # # # # # # # # # # # # # # #         for j in range(min(l,r),max(l,r)+1):
# # # # # # # # # # # # # # # #             for k in range(min(l,r),max(l,r)):
# # # # # # # # # # # # # # # #                 n=(m+j-k)//i
# # # # # # # # # # # # # # # #                 if(n>0):
# # # # # # # # # # # # # # # #                     x+=1
# # # # # # # # # # # # # # # #                     y.append((i,j,k))
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #     print(y)
# # # # # # # # # # # # # # # #     for i in y:
# # # # # # # # # # # # # # # #         if(len(set(i))==3):
# # # # # # # # # # # # # # # #             print(i)
# # # # # # # # # # # # # # # #         break
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #     a-=1
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # while(a!=0):
# # # # # # # # # # # # # # # #     x=0
# # # # # # # # # # # # # # # #     l,r,m=map(int,input().split())
# # # # # # # # # # # # # # # #     for i in range(min(l,r),max(l,r)+1):
# # # # # # # # # # # # # # # #         for j in range(min(l,r),max(l,r)+1):
# # # # # # # # # # # # # # # #             for k in range(min(l,r),max(l,r)):
# # # # # # # # # # # # # # # #                 n=(m+j-k)//i
# # # # # # # # # # # # # # # #                 if(n>0):
# # # # # # # # # # # # # # # #                     x+=1
# # # # # # # # # # # # # # # #                     print(i,j,k)
# # # # # # # # # # # # # # # #                 if(x==1):
# # # # # # # # # # # # # # # #                     break
# # # # # # # # # # # # # # # #             if(x==1):
# # # # # # # # # # # # # # # #                 break
# # # # # # # # # # # # # # # #         if(x==1):
# # # # # # # # # # # # # # # #             break
# # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # #         continue
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #     a-=1
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # t = int(input().strip())
# # # # # # # # # # # # # # # # for _ in range(t):
# # # # # # # # # # # # # # # #     l, r, m = map(int, input().split())
# # # # # # # # # # # # # # # #     max_diff = r - l
# # # # # # # # # # # # # # # #     for i in range(l, r + 1):
# # # # # # # # # # # # # # # #         temp = m - (m - m % i)
# # # # # # # # # # # # # # # #         if temp <= max_diff:
# # # # # # # # # # # # # # # #             if m < l:
# # # # # # # # # # # # # # # #                 print('{} {} {}'.format(i, l, l + temp))
# # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # #                 print('{} {} {}'.format(i, l + temp, l))
# # # # # # # # # # # # # # # #             break
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # ##░░░░░░░░░░░░░░░░░░░░░░░░░░░░╔═══╗╔╗╔═══╦═══╗
# # # # # # # # # # # # # # # # ░░░░░░░░░░░░░░░░░░░░░░░░░░░░║╔═╗╠╝║║╔═╗║╔═╗║
# # # # # # # # # # # # # # # # ╔══╦═╗╔══╦═╗╔╗░╔╦╗╔╦══╦╗╔╦══╬╝╔╝╠╗║║║║║╠╝╔╝║
# # # # # # # # # # # # # # # # ║╔╗║╔╗╣╔╗║╔╗╣║░║║╚╝║╔╗║║║║══╬╗╚╗║║║║║║║║░║╔╝
# # # # # # # # # # # # # # # # ║╔╗║║║║╚╝║║║║╚═╝║║║║╚╝║╚╝╠══║╚═╝╠╝╚╣╚═╝║░║║░
# # # # # # # # # # # # # # # # ╚╝╚╩╝╚╩══╩╝╚╩═╗╔╩╩╩╩══╩══╩══╩═══╩══╩═══╝░╚╝░
# # # # # # # # # # # # # # # # ░░░░░░░░░░░░╔═╝║░░░░░░░░░░░░░░░░░░░░░░░░░░░░
# # # # # # # # # # # # # # # # ░░░░░░░░░░░░╚══╝░░░░░░░░░░░░░░░░░░░░░░░░░░░░
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # try:
# # # # # # # # # # # # # # # # #     a=int(input())
# # # # # # # # # # # # # # # # #     while(a!=0):
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #         b=int(input())
# # # # # # # # # # # # # # # # #         c,d=map(int,input().split())
# # # # # # # # # # # # # # # # #         e=int(input())
# # # # # # # # # # # # # # # # #         for i in range(e):
# # # # # # # # # # # # # # # # #             f=list(map(int,input().split()))
# # # # # # # # # # # # # # # # #             if(f[0]+f[1]<c):
# # # # # # # # # # # # # # # # #                 print(0)
# # # # # # # # # # # # # # # # #             elif(c<f[0]+f[1]<d):
# # # # # # # # # # # # # # # # #                 print(c)
# # # # # # # # # # # # # # # # #             elif(f[0]+f[1]>d):
# # # # # # # # # # # # # # # # #                 print(d-c)
# # # # # # # # # # # # # # # # #             elif(f[0]+f[1]==c or f[0]+f[1]==d):
# # # # # # # # # # # # # # # # #                 print(-1)
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #         a-=1
# # # # # # # # # # # # # # # # # except:
# # # # # # # # # # # # # # # # #     pass
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # try:
# # # # # # # # # # # # # # # # #     a=int(input())
# # # # # # # # # # # # # # # # #     while(a!=0):
# # # # # # # # # # # # # # # # #         b=int(input())
# # # # # # # # # # # # # # # # #         c=list(map(int,input().split()))
# # # # # # # # # # # # # # # # #         d=1
# # # # # # # # # # # # # # # # #         for i in c:
# # # # # # # # # # # # # # # # #             d*=i
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #         if(d%2==0):
# # # # # # # # # # # # # # # # #             print('NO')
# # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # #             print('Yes')
# # # # # # # # # # # # # # # # #         a-=1
# # # # # # # # # # # # # # # # # except:
# # # # # # # # # # # # # # # # #     pass
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # a={'A':1,'B':2}
# # # # # # # # # # # # # # # # b=2
# # # # # # # # # # # # # # # # c=[]
# # # # # # # # # # # # # # # # for i in a.keys():
# # # # # # # # # # # # # # # #     c.append(i)
# # # # # # # # # # # # # # # # for i in c:
# # # # # # # # # # # # # # # #     if(a.get(i)==b):
# # # # # # # # # # # # # # # #         print(i)
# # # # # # # # # # # # # # # #         break
# # # # # # # # # # # # # # # # else:
# # # # # # # # # # # # # # # #     print('no such value :P')
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # a={'A':1,'B':2}
# # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # a={x:key for key , x in a.items()}
# # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # print(a.get(1))
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # from pytube import YouTube
# # # # # # # # # # # # # # # # # from pytube import extract
# # # # # # # # # # # # # # # # # from pytube.streams import Stream
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # YouTube("Your link here").streams.first().download()
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # def getPairsCount(arr, n, sum):
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #     for i in range(0, n):
# # # # # # # # # # # # # # # # #         for j in range(i + 1, n):
# # # # # # # # # # # # # # # # #             if arr[i] + arr[j] == sum:
# # # # # # # # # # # # # # # # #                 c=[]
# # # # # # # # # # # # # # # # #                 c.append(str(arr[i]))
# # # # # # # # # # # # # # # # #                 c.append(str(arr[j]))
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #                 print(' '.join(c))
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # d=[]
# # # # # # # # # # # # # # # # # for i in range(1,(a**2)+1):
# # # # # # # # # # # # # # # # #     d.append(i)
# # # # # # # # # # # # # # # # # arr = d
# # # # # # # # # # # # # # # # # n = len(arr)
# # # # # # # # # # # # # # # # # sum = arr[0]+arr[len(arr)-1]
# # # # # # # # # # # # # # # # # y=getPairsCount(arr,n,sum)
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # for i in range(a):
# # # # # # # # # # # # # # # # #     b,c=map(int,input().split())
# # # # # # # # # # # # # # # # #     print(min(b,c,(b+c)//3))
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #     if a == 0:
# # # # # # # # # # # # # # # # #         return b
# # # # # # # # # # # # # # # # #     return gcd(b % a, a)
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # def lcm(a,b):
# # # # # # # # # # # # # # # # #     return (a*b) // gcd(a,b)
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # def getPairsCount(arr, n, sum):
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #     c=[]
# # # # # # # # # # # # # # # # #     for i in range(0, n):
# # # # # # # # # # # # # # # # #         for j in range(i + 1, n):
# # # # # # # # # # # # # # # # #             if arr[i] + arr[j] == sum:
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #                 c.append(arr[i])
# # # # # # # # # # # # # # # # #                 c.append(arr[j])
# # # # # # # # # # # # # # # # #     return c
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # n=int(input())
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # for i in range(n):
# # # # # # # # # # # # # # # # #     x=int(input())
# # # # # # # # # # # # # # # # #     d=[]
# # # # # # # # # # # # # # # # #     for i in range(x):
# # # # # # # # # # # # # # # # #         d.append(i)
# # # # # # # # # # # # # # # # #     arr = d
# # # # # # # # # # # # # # # # #     n = len(arr)
# # # # # # # # # # # # # # # # #     sum = x
# # # # # # # # # # # # # # # # #     y=getPairsCount(arr,n,sum)
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #     if(x%2==0):
# # # # # # # # # # # # # # # # #         print(x//2,x//2)
# # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # #         e=[]
# # # # # # # # # # # # # # # # #         for i in range(len(y)):
# # # # # # # # # # # # # # # # #             if(i%2==0):
# # # # # # # # # # # # # # # # #                 e.append(lcm(y[i],y[i+1]))
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #         z=(e.index(min(e)))
# # # # # # # # # # # # # # # # #         print(y[z*2],y[(z*2)+1])
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # for i in range(a):
# # # # # # # # # # # # # # # # # #     b=int(input())
# # # # # # # # # # # # # # # # # #     for j in range(b):
# # # # # # # # # # # # # # # # # #         print('1',end=' ')
# # # # # # # # # # # # # # # # # #     print()
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # c=[]
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # while(a!=0):
# # # # # # # # # # # # # # # # # #     b=int(input())
# # # # # # # # # # # # # # # # # #     if(b<=2):
# # # # # # # # # # # # # # # # # #         for j in range(1000):
# # # # # # # # # # # # # # # # # #             c.append(j)
# # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # #         for k in range(b):
# # # # # # # # # # # # # # # # # #             for l in range(1000):
# # # # # # # # # # # # # # # # # #                 if(k>=2):
# # # # # # # # # # # # # # # # # #                     for m in range(k):
# # # # # # # # # # # # # # # # # #                         if(c[m]+c[m+1]==c[m+2]):
# # # # # # # # # # # # # # # # # #                             pass
# # # # # # # # # # # # # # # # # #                         else:
# # # # # # # # # # # # # # # # # #                             c.append(l)
# # # # # # # # # # # # # # # # # #                 else:
# # # # # # # # # # # # # # # # # #                     c.append(l)
# # # # # # # # # # # # # # # # # #     print(c)
# # # # # # # # # # # # # # # # # #     a-=1
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # while(True):
# # # # # # # # # # # # # # # # # #     import random
# # # # # # # # # # # # # # # # # #     #
# # # # # # # # # # # # # # # # # #     # a,b=map(int,input().split())
# # # # # # # # # # # # # # # # # #     #
# # # # # # # # # # # # # # # # # #     # c=random.randint(1,6)
# # # # # # # # # # # # # # # # # #     #
# # # # # # # # # # # # # # # # # #     # print(c)
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # while(True):
# # # # # # # # # # # # # # # # # # #     a=[1,2,3]
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #     i=int(input('Enter any number to check thatt it is present in list or not'))
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #     if(i in a):
# # # # # # # # # # # # # # # # # # #         print('Yes')
# # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # #         print('No')
# # # # # # # # # # # # # # # # # # #         #there are two w
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # #for i in range(len(b))
# # # # # # # # # # # # # # # # # # #print(9n-1)
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #prin(n-1)# for i in range(a):
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #     b = list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # #     if b[0]>3 and b[1]>3 and b[2]>3:
# # # # # # # # # # # # # # # # # # #         print(7)
# # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # #         if 1 in b:
# # # # # # # # # # # # # # # # # # #             c = b.count(1)
# # # # # # # # # # # # # # # # # # #             if c==1 and b.count(0)==2:
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif c==1 and b.count(0)==1:
# # # # # # # # # # # # # # # # # # #                 print(2)
# # # # # # # # # # # # # # # # # # #             elif c==1:
# # # # # # # # # # # # # # # # # # #                 print(4)
# # # # # # # # # # # # # # # # # # #             elif c==2 and b.count(0)==1:
# # # # # # # # # # # # # # # # # # #                 print(2)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #         elif 2 in b:
# # # # # # # # # # # # # # # # # # #             c = b.count(2)
# # # # # # # # # # # # # # # # # # #             if c==3:
# # # # # # # # # # # # # # # # # # #                 print(4)
# # # # # # # # # # # # # # # # # # #             elif c==1 and b.count(0)==2:
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif c==1 and b.count(0)==1:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             elif c==2 and b.count(0)==1:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(5)
# # # # # # # # # # # # # # # # # # #         elif 3 in b:
# # # # # # # # # # # # # # # # # # #             if c==1 and b.count(0)==2:
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif c==1 and b.count(0)==1:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(6)
# # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # #             if b.count(0)==3:
# # # # # # # # # # # # # # # # # # #                 print(0)
# # # # # # # # # # # # # # # # # # #             elif b.count(0)==2:
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # for i in range(a):
# # # # # # # # # # # # # # # # # # #     b=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #     if(b[0]>3 and b[1]>3 and b[2]>3):
# # # # # # # # # # # # # # # # # # #         print(7)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #         if(1 in b):
# # # # # # # # # # # # # # # # # # #             c=b.count(1)
# # # # # # # # # # # # # # # # # # #             if(c==1 and b.count(0)==2):
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif(c==1 and b.count(0)==1):
# # # # # # # # # # # # # # # # # # #                 print(2)
# # # # # # # # # # # # # # # # # # #             elif(c==1):
# # # # # # # # # # # # # # # # # # #                 print(4)
# # # # # # # # # # # # # # # # # # #             elif(c==2 and b.count(0)==1):
# # # # # # # # # # # # # # # # # # #                 print(2)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #         elif(2 in b):
# # # # # # # # # # # # # # # # # # #             c=b.count(2)
# # # # # # # # # # # # # # # # # # #             if(c==2 and b.count(0)==1):
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             elif(c==3):
# # # # # # # # # # # # # # # # # # #                 print(4)
# # # # # # # # # # # # # # # # # # #             elif(c==1 and b.count(0)==2):
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif(c==1 and b.count(0)==1):
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(5)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #         elif(3 in b):
# # # # # # # # # # # # # # # # # # #             c=b.count(3)
# # # # # # # # # # # # # # # # # # #             if(c==1 and b.count(0)==2):
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             elif(c==1 and b.count(0)==1):
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(6)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # #             if(b.count(0)==3):
# # # # # # # # # # # # # # # # # # #                 print(0)
# # # # # # # # # # # # # # # # # # #             elif(b.count(0)==2):
# # # # # # # # # # # # # # # # # # #                 print(1)
# # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # #                 print(3)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #     #a-=1
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # for i in range(a):
# # # # # # # # # # # # # # # # # # #     b,c,d=map(int,input().split())
# # # # # # # # # # # # # # # # # # #     if(a==0):
# # # # # # # # # # # # # # # # # # #         if(b==0 and c==0):
# # # # # # # # # # # # # # # # # # #             print(0)
# # # # # # # # # # # # # # # # # # #         if(b==0 or c==0):
# # # # # # # # # # # # # # # # # # #             print(1)
# # # # # # # # # # # # # # # # # # #         if(b>=2 and c>=2):
# # # # # # # # # # # # # # # # # # #             print(3)
# # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # a=[1,3]
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # b=[2]
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # c=a+b
# # # # # # # # # # # # # # # # # # # # print(c)
# # # # # # # # # # # # # # # # # # # # print(id(c))
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # a='rahul'
# # # # # # # # # # # # # # # # # # # # # b=a
# # # # # # # # # # # # # # # # # # # # # print(id(a))
# # # # # # # # # # # # # # # # # # # # # print(id(b))
# # # # # # # # # # # # # # # # # # # # # print()
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # for i in range(5):
# # # # # # # # # # # # # # # # # # # # #     a+='mahajan'
# # # # # # # # # # # # # # # # # # # # #     print(id(a))
# # # # # # # # # # # # # # # # # # # # #     print(a)
# # # # # # # # # # # # # # # # # # # # # f
# # # # # # # # # # # # # # # # # # # # # print(id(a))
# # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # print(id(b))
# # # # # # # # # # # # # # # # # # # # # # a='rahul'+'mahajan'
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # b=a
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # print(id(a))
# # # # # # # # # # # # # # # # # # # # # # print(id(b))
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # def ckeckList(lst):
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # #     ele = lst[0]
# # # # # # # # # # # # # # # # # # # # # # #     chk = True
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # #     # Comparing each element with first item
# # # # # # # # # # # # # # # # # # # # # # #     for item in lst:
# # # # # # # # # # # # # # # # # # # # # # #         if ele != item:
# # # # # # # # # # # # # # # # # # # # # # #             chk = False
# # # # # # # # # # # # # # # # # # # # # # #             break
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # #     if (chk == True):
# # # # # # # # # # # # # # # # # # # # # # #         print("Equal")
# # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # #         print("Not equal")
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # Driver Code
# # # # # # # # # # # # # # # # # # # # # # # a=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # ckeckList(a)
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # a=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # b=a[0]
# # # # # # # # # # # # # # # # # # # # # # # c=True
# # # # # # # # # # # # # # # # # # # # # # # for i in a:
# # # # # # # # # # # # # # # # # # # # # # #     if(i!=b):
# # # # # # # # # # # # # # # # # # # # # # #       c=False
# # # # # # # # # # # # # # # # # # # # # # #       break
# # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # if(c==True):
# # # # # # # # # # # # # # # # # # # # # # #     print(1)
# # # # # # # # # # # # # # # # # # # # # # # else:
# # # # # # # # # # # # # # # # # # # # # # #     print(0)
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # # # # # # x=0
# # # # # # # # # # # # # # # # # # # # # # # y=0
# # # # # # # # # # # # # # # # # # # # # # #     d=[]
# # # # # # # # # # # # # # # # # # # # # # # e=[]
# # # # # # # # # # # # # # # # # # # # # # # for i in range(a):
# # # # # # # # # # # # # # # # # # # # # # #     b=int(input())
# # # # # # # # # # # # # # # # # # # # # # #     c=[]
# # # # # # # # # # # # # # # # # # # # # # #     for i in range(1,b+1):
# # # # # # # # # # # # # # # # # # # # # # #         c.append(i)
# # # # # # # # # # # # # # # # # # # # # # #     if(max(c)==1):
# # # # # # # # # # # # # # # # # # # # # # #         print(1)
# # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # #         if(len(c)%2==0):
# # # # # # # # # # # # # # # # # # # # # # #             for j in range(len(c)):
# # # # # # # # # # # # # # # # # # # # # # #                 if(j<((len(c)//2)-1)):
# # # # # # # # # # # # # # # # # # # # # # #                     x=c[j]+c[len(c)-2-j]
# # # # # # # # # # # # # # # # # # # # # # #                     d.append(x)
# # # # # # # # # # # # # # # # # # # # # # #             print(len(d)+1)
# # # # # # # # # # # # # # # # # # # # # # #         elif(len(c)//2!=0):
# # # # # # # # # # # # # # # # # # # # # # #             print((len(c)//2)+1)
# # # # # # # # # # # # # # # # # # # # # # #        #      for k in range(len(c)):
# # # # # # # # # # # # # # # # # # # # # # #        # #         e=[]
# # # # # # # # # # # # # # # # # # # # # # #        #          y=c[k]+c[len(c)-2-k]
# # # # # # # # # # # # # # # # # # # # # # #        #          e.append(y)
# # # # # # # # # # # # # # # # # # # # # # #        #      print(len(e)+1)
# # # # # # # # # # # # # # # # # # # # # # #         d.clear()
# # # # # # # # # # # # # # # # # # # # # # #         e.clear()
# # # # # # # # # # # # # # # # # # # # # # # # print(36+10)
# # # # # # # # # # # # # # # # # # # # # # # # print(36-8)
# # # # # # # # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # c=0
# # # # # # # # # # # # # # # # # # # # # # # # # i=0
# # # # # # # # # # # # # # # # # # # # # # # # # while(a!=0):
# # # # # # # # # # # # # # # # # # # # # # # # #     b=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # #     if(b==1):
# # # # # # # # # # # # # # # # # # # # # # # # #         print(0)
# # # # # # # # # # # # # # # # # # # # # # # # #     elif(b==2):
# # # # # # # # # # # # # # # # # # # # # # # # #         print((-1))
# # # # # # # # # # # # # # # # # # # # # # # # #     elif(b>2):
# # # # # # # # # # # # # # # # # # # # # # # # #         while(c==1):
# # # # # # # # # # # # # # # # # # # # # # # # #             if(b%6==0):
# # # # # # # # # # # # # # # # # # # # # # # # #                 c=(b%6)
# # # # # # # # # # # # # # # # # # # # # # # # #                 i+=1
# # # # # # # # # # # # # # # # # # # # # # # # #             else:
# # # # # # # # # # # # # # # # # # # # # # # # #                 c=b*2
# # # # # # # # # # # # # # # # # # # # # # # # #                 i+=1
# # # # # # # # # # # # # # # # # # # # # # # # #         print(i)
# # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # while(a!=0):
# # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # #     b,c,d=map(int,input().split())
# # # # # # # # # # # # # # # # # # # # # # # # # #     e=[]
# # # # # # # # # # # # # # # # # # # # # # # # # #     for i in range(d+1):
# # # # # # # # # # # # # # # # # # # # # # # # # #         if(i%b==c):
# # # # # # # # # # # # # # # # # # # # # # # # # #             e.append(i)
# # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # #     print(max(e))
# # # # # # # # # # # # # # # # # # # # # # # # # #     a-=1
# # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # a="""Number 1\t The Larch
# # # # # # # # # # # # # # # # # # # # # # # # # # # Number 2\t the horse chestnut"""
# # # # # # # # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # a="""hello1\trahul
# # # # # # # # # # # # # # # # # # # # # # # # # # # # mahajan\tmahajana
# # # # # # # # # # # # # # # # # # # # # # # # # # # # """
# # # # # # # # # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # b=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=sorted(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # d=min(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # e=c.count(d)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # f=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(f!=e):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #     c.remove(a[f])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #     f+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # z=sorted(c,reverse= 021)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # g=max(z)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # h=z.count(g)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # j=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(j!=h):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #     z.remove(z[j])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #     j+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #print(z)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(len(z))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=[1,1,2,3,3]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in a:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #     a.remove(min(a))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=[1,1,1,2,2,3,4,3]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=sorted(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # d=min(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # e=c.count(d)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # f=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(f!=e):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     c.remove(a[f])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     f+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # z=sorted(c,reverse=1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # g=max(z)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # h=z.count(g)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # j=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(j!=h):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     c.remove(a[j])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     j+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(z)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # n,b,d=map(int,input().split())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # j=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in range(n):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(a[i]>b):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(len(a)==0):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         print(0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         c+=a[i]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if(c>d):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     j+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in range(len(a)):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(a[i]>=b):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         a.remove(a[i])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         break
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(j)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=map(str,input().split())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=set(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(1):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     a=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     b=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     c=b.count(1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     d=b.count(2)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     e=b.count(3)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(c==0 or d==0 or e==0):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         print(0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         if(c<=d and c<=e):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         elif(d<=c and d<=e):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             print(d)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             print(e)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(1):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     n,b,d=map(int,input().split())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     a=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     c=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     j=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     for i in range(n):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         if(a[i]>b):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             a.remove(a[i])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             break
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         if(len(a)==0):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             print(0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             c+=a[i]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(c>d):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         j+=1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         pass
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     for i in range(len(a)):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         if(a[i]>=b):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             a.remove(a[i])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             break
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     print(j)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=['r','b','g']
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=len(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in range(len(a)):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     print(a[i-1])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print('-'*20)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in range(len(a)):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     print(a[i])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # b=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # d=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # while(len(b)!=0):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     if(len(b)%2==0):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         x=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         c=c+x[(len(b)-1)]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         b.remove(x[(len(b)-1)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         #print(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         y=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         #print(y)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         d=d+y[(len(b)-1)]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         b.remove(y[(len(b)-1)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         if(len(b)==1):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             x=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             c=c+x[(len(b)-1)]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             b.remove(x[(len(b)-1)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             #print(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             y=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         else:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             x=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             c=c+x[(len(b)-1)]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             b.remove(x[(len(b)-1)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             #print(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             y=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             #print(y)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             d=d+y[(len(b)-1)]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #             b.remove(y[(len(b)-1)])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         # b.remove(x[a-1])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         # # y=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         # d=d+y[-1]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         # b.remove(y[len(b)-1])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #         # a=a-1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print('{0} {1}'.format(c,d))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # print(len(b))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # s=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # c=c+s[len(s)-1]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # print(c)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # b=list(map(int,input().split()))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # print(maxi(b))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # print(len(b))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # x=sorted(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     # print(x[a-1])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # a=[]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # for i in range(10):
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     b=int(input())
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #     a.append(b)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # j=0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # c=sorted(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(c[9])
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # j=j+c[len(a)-1]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(j)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(a)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(len(a)-1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print(max(a))  
    c[e-1] -= f
g= 0
for i in c:
    if i > 0:
        g+= i
print(g)