package test; import java.util.Scanner; public class test { public static void main(String[] args) { short b[] = {4,2,8,5,7,1}; Scanner s = new Scanner(System.in); String string = s.nextLine(); System.out.println(b[Integer.parseInt(string)%6]); s.close(); } }