import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        ArrayList<Integer> niz1 = new ArrayList<>();
        System.out.println("Unesi ogranicenje za niz1");
        int n1 = sc.nextInt();
        for (int i = 0; i < n1; i++) {
            niz1.add((int)(Math.random() * 10) + 1);
        }

        System.out.println("Unesi ogranicenje za niz2");
        int n2 = sc.nextInt();
        ArrayList<Integer> niz2 = new ArrayList<>();
        for (int i = 0; i < n2; i++) {
            niz2.add((int)(Math.random() * 10) + 1);
        }

        System.out.println(niz1);
        System.out.println(niz2);

        int xor=0;
        for (int i = 0; i < niz1.size(); i++) {
            xor = xor ^ niz1.get(i);
        }
     
        int and = 1;
        for (int i = 0; i < niz2.size(); i++) {
            and = and & niz2.get(i);
           
        }
 
        int proizvod = and * xor;
        System.out.println("Proizvods je: " + proizvod);
    }
}