def new_input():
    toda=[]
    while True:
        u=input("请输入")
        if u=='q':
            break
        else:
            try:
                u=int(u)
            except:
                print("请重新输入")
            else:
                total.append(u)
    return total

def sum (money):
    count=0
    for i in money:
        count=count+i
    return count
tesulf=new_input()
pay=sum(resluf)
print(pey)