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

struct node {
	int x;
	int y;
	struct node *next;
};

struct node* createNode(int x, int y, struct node* previous) {

	struct node *temp;
	temp=malloc(sizeof(struct node)); //malloc returns the starting address of the allocated memory
	(*temp).x=x;
	(*temp).y=y;

	(*previous).next=temp;	


	return temp;
}

main(){

	struct node *newNode;
	struct node *previousNode;
	struct node *secondToLastNode;
	
	struct node firstNode; 
	scanf("%d",&firstNode.x);
	scanf("%d",&firstNode.y);

	previousNode=&firstNode;

	int readX;
	int readY;

	do{
		scanf("%d",&readX);
		scanf("%d",&readY);
		if(readX!=0||readY!=0){
			newNode = createNode(readX,readY,previousNode);
			secondToLastNode=previousNode;
			previousNode=newNode;
		}

	}while(readX!=0||readY!=0);


	
	//remember the last node
	struct node *lastNode = secondToLastNode;
	//start at the first node
	struct node *currentNode=&firstNode;
	//struct node *temp;

	//fprintf(stderr,"dude");

	do{
		//printf("yo");
		printf("%d\n",((*currentNode).x)*((*currentNode).x)+((*currentNode).y)*((*currentNode).y));
		currentNode = (*currentNode).next;
		//currentNode=temp;
	}while(currentNode!=newNode);

	//print the last one
	printf("%d\n",((*currentNode).x)*((*currentNode).x)+((*currentNode).y)*((*currentNode).y));


	//printf("%d\n",(*(*(firstNode.next)).next).x);

	//secondNode=createNode(5,5,firstNode);
	//printf("%d\n",(*((*firstNode).next)).x);
	//printf("%d\n",(*(firstNode.next)).x);

}