import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static class City implements Comparable{ int lat; int lon; int height; int points; public City(int lat, int lon, int height, int points){ this.lat=lat; this.lon = lon; this.height = height; this.points = points; } public int compareTo(City c){ return this.height-c.height; } } static long getMaxSum(ArrayList cities, int n, int x, int y){ Collections.sort(cities); long maxSum = 0; long sum = 0; City prev = null; for(int k=0;k cities = new ArrayList(); for(int a0 = 0; a0 < n; a0++){ int latitude = in.nextInt(); int longitude = in.nextInt(); int height = in.nextInt(); int points = in.nextInt(); // your code goes here cities.add(new City(latitude,longitude,height,points)); } System.out.println(getMaxSum(cities,n,x,y)); } }