package com.codegym.task.task05.task0529;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/*
Console-based piggy bank

*/

public class Solution {
    public static void main(String[] args) throws Exception {
       BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int total = 0;
    String s = "sum";
    String firstNumber = reader.readLine();

    while(!(firstNumber.equals(s))){
      String sNumber = reader.readLine();

      if(sNumber.equals(s)){
        System.out.print(total + Integer.parseInt(firstNumber));
      }else {
        int number = Integer.parseInt(sNumber);
        total += number;
      }
    }

    }
}