import java.util.*; public class Main { private static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { int a = sc.nextInt(); for (int i = 8;i <= 100; i++) { if (a - i == 7) { System.out.println(i); return; } } System.out.println(-1); } }