#include int main() { int n; scanf("%d", &n); n = (n - 1) % 6; char s[8] = "285714"; printf("%c\n", s[n]); return 0; }