while True:
    try:

        a = list(map(int,input().split()))
        f = a[0]
        arr=[]
        for i in a[1:]:
            if i<f:
                arr.append(i)

        print(sum(arr))
    except:
        break