@@ -0,0 +1,899 @@
+import java.io.*;%0Aimport java.math.*;%0Aimport java.security.*;%0Aimport java.text.*;%0Aimport java.util.*;%0Aimport java.util.concurrent.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A    // Complete the fairRations function below.%0A    static int fairRations(int%5B%5D B) %7B%0A        int count = 0;%0A        for(int i=0;i%3CB.length-1;i++)%7B%0A            if(B%5Bi%5D%252==1)%7B%0A                B%5Bi%5D++;%0A                B%5Bi+1%5D++;%0A                count+=2;%0A            %7D%0A        %7D%0A        if(B%5BB.length-1%5D%252==1) return -1;%0A        else return count;%0A    %7D%0A    public static void main(String%5B%5D args)%7B%0A        Scanner sc = new Scanner(System.in);%0A        int N = sc.nextInt();%0A        int%5B%5D B = new int%5BN%5D;%0A        for (int i = 0; i %3C N; i++) %7B%0A            B%5Bi%5D = sc.nextInt();%0A        %7D%0A        int result = fairRations(B);%0A        if(result%3E=0) System.out.println(result);%0A        else System.out.println(%22NO%22);%0A    %7D%0A%7D%0A

add FairRations.java