import java.util.Scanner; public class Number { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s = new Scanner(System.in); int N = s.nextInt(); s.close(); if(N == 1){ System.out.println("7"); }else if(N ==2){ System.out.println("8"); }else if(N == 3){ System.out.println("9"); }else if(N == 4){ System.out.println("0"); }else if(N == 6){ System.out.println("6"); }else if(N == 7){ System.out.println("4"); }else if(N == 8){ System.out.println("2"); }else if(N == 9){ System.out.println("3"); }else if(N == 10){ System.out.println("8"); }else if(N == 5){ System.out.println("5"); } } }