static double prim(double[][] mAdy){
		int n,p[]=new int[n=mAdy.length],v=0;double d[]=new double[n];boolean[] vis=new boolean[n];
		PriorityQueue<double[]> cola=new PriorityQueue<double[]>(n,new Comparator<double[]>() {
			public int compare(double[] o1,double[] o2){
				return o1[1]!=o2[1]?(o1[1]<o2[1]?-1:1):(int)o1[0]-(int)o2[0];
			}
		});
		Arrays.fill(d, Double.POSITIVE_INFINITY);d[v]=0;vis[v]=true;
		Arrays.fill(p, -1);cola.add(new double[]{v,0});
		for(;!cola.isEmpty();){
			double[] ult=cola.poll();int s=(int)ult[0];vis[s]=true;
			for(int u=0;u<n;u++)
				if(u!=s&&!vis[u]&&d[u]>mAdy[s][u]){
					p[u]=s;
					cola.add(new double[]{u,d[u]=mAdy[s][u]});
				}
		}
		double res=0;
		for(int i=0;i<n;i++)if(p[i]>=0){res+=mAdy[p[i]][i];}
		return res;
	}