import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Comparator; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Set; public class Main { public static void main(String[] args) { new Main().run(); } void updown(long[] dist, int[] level) { int N=dist.length; for (int i=1;i=0;--i) { dist[i]=Math.min(dist[i], dist[i+1]+level[i+1]-level[i]); } } void run() { FastScanner sc=new FastScanner(); int N=sc.nextInt(); int M=sc.nextInt(); int K=sc.nextInt()-1; int S=sc.nextInt()-1; int T=sc.nextInt()-1; int[][] es=new int[N][3]; int[][] level=new int[N][]; long[][] dist=new long[N][]; long INF=Long.MAX_VALUE/3; for (int i=0;i a+1 es[i][1]=sc.nextInt(); es[i][2]=sc.nextInt(); --es[i][0]; --es[i][1]; --es[i][2]; } Arrays.sort(es, Comparator.comparing((int[] v)->v[0]).thenComparing(v->v[0])); Set[] set=new HashSet[N]; for (int i=0;i(); for (int i=0;i Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }