

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;


public class ACC_DFS_fixed {

	static double[] enjoyment;	
	static List<List<Integer>> connections;
	
	static double[] maxima;
	static Stack<Integer> s;
	
	static Boolean[] visited;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt(); int m = sc.nextInt();
		
		enjoyment = new double[n];
		connections = new ArrayList<List<Integer>>(n);
		
		maxima = new double[n];		
		visited = new Boolean[n];
		
		for(int i = 0; i < n; i++)
		{
			connections.add(new ArrayList<Integer>());
			visited[i] = false;
		}
			
		
		for(int i = 0; i < n; i++)
			enjoyment[i] = sc.nextDouble();
		for(int j = 0; j < m; j++)
		{
			int s = sc.nextInt(); int t = sc.nextInt();
			connections.get(s).add(t);
		}
		for(int i = 0; i < n; i++)
			maxima[i] = -1; // Initialization at a negative value to check whether we've calculated this place already.
		
		
		s = new Stack<Integer>();
		s.add(0);
		while(!s.isEmpty())
		{
			int a = s.pop();

			if(maxima[a] != -1) continue;
			if(visited[a]) // We have visited this node, but it isn't fully processed yet i.e. we're on our way back.
			{
				maxima[a] = enjoyment[a];
				for(int c: connections.get(a))
				{
					maxima[a] = Math.max(maxima[a], maxima[c]); // We skip pizza stand a and go to stand c.
					maxima[a] = Math.max(maxima[a], 0.5 * maxima[c] + enjoyment[a]); // We consume delicious pizza at stand a and go to stand c.
				}
			}
			else // We've not seen this node yet. We add it again to the stack and add all its children.
			{
				visited[a] = true;
				s.add(a);
				for(int c: connections.get(a))
					if(maxima[c] == -1) // We only want to add a node here if we haven't processed it yet.
						s.add(c);
			}
			
			
		}
		System.out.println(maxima[0]);
	}
	

}
