import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class Test05 {
	public static void main(String[] args) throws IOException {
		Scanner inf = new Scanner(new FileReader("d:\\data02.txt"));
		Scanner scanf = new Scanner(System.in);
		int cnt, j, L, h, m, bun, kor, eng, mat;
		int data[][] = new int[2][30];
		cnt = -1;
		while (true)
		{
			cnt++;
			if(!inf.hasNext())
				break;
			bun = inf.nextInt();
			kor = inf.nextInt();
			eng = inf.nextInt();
			mat = inf.nextInt();
			data[0][cnt] = bun;
			data[1][cnt] = kor + mat + eng;
		}
		cnt--;
		j = scanf.nextInt();
		L = 0;
		h = cnt;
		while (true)
		{
			if (L <= h)
			{
				m = (L + h) / 2;
				if (j == data[0][m])
				{
					System.out.printf("%d %d", j, data[1][m]);
					break;
				}
				if (j < data[0][m])
					h = m - 1;
				else
					L = m + 1;
			}
			else
			{
				System.out.printf("%d NOT FOUND", j);
				break;
			}
		}
		inf.close();
		scanf.close();
	}
}
