import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class PizzaWorld_HarryACC { static double[] enjoyment; static List> connections; static double[] maxima; 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>(n); maxima = new double[n]; for(int i = 0; i < n; i++) connections.add(new ArrayList()); 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. System.out.println(dp(0)); } public static double dp(int s) { if(maxima[s] != -1) return maxima[s]; maxima[s] = enjoyment[s]; for(int t: connections.get(s)) { double dpt = dp(t); if(dpt > maxima[s]) maxima[s] = dpt; double value = enjoyment[s] + 0.5 * dpt; if(value > maxima[s]) maxima[s] = value; } return maxima[s]; } }