#include <stdio.h>
#include <stdlib.h>

int points(int n, int reqs[1][16]){

	int mass = 0;
	int last_ball;

	for(int i = 0; i < n; i++){

		if(mass > 0){

			mass = mass + reqs[1][i];
			last_ball = reqs[1][i];

			printf("%d\n", mass);

		}else if(mass == 0){

			mass = mass - last_ball;
			printf("%d\n", mass);

		}

	}

}

int main()
{

    int n = 8;
    int requests[2][16];

    //scanf("%d", &n);

    for(int i = 0; i < n; i++){

		scanf("%d", &requests[0][i]);
		scanf("%d", &requests[1][i]);

    }

    points(n, requests);

}
