const lines = require('fs') .readFileSync('/dev/stdin', 'utf-8') .trim().split('\n').values(); const A = Number(lines.next().value); let ans = -1; for (let i = 2; i <= A; i++) { if (Math.floor(A / i) === 1 && A % i === 7) { ans = i; break; } } console.log(ans);