static boolean dijkstra(double a){
		Arrays.fill(sol,Double.POSITIVE_INFINITY);
		Arrays.fill(ant,-1);
		Arrays.fill(vis,false);
		sol[S]=0;
		vis[S]=true;
		PriorityQueue<double[]> cola=new PriorityQueue<double[]>(N,new Comparator<double[]>(){
			public int compare(double[] o1,double[] o2){
				if(o1[0]<o2[0])return -1;
				if(o1[0]>o2[0])return 1;
				return (int)o1[1]-(int)o2[1];
			}
		});
		cola.add(new double[]{S,0});
		for(double[] u;!cola.isEmpty();) {
			u=cola.poll();
			int v=(int)u[1];
			vis[v]=true;
			for(int h:lAdy[v]) {
				if(!vis[h]){
					double min=Double.POSITIVE_INFINITY;
					for(double[] k:mAdy[v][h])
						if(k[0]<=a)min=min(k[1],min);
					if(sol[h]>sol[v]+min) {
						cola.add(new double[]{sol[h]=sol[v]+min,h});
						ant[h]=v;
					}
				}
			}
		}
		return sol[T]<Double.POSITIVE_INFINITY;
	}