import strutils

const s = "285714"
let n = parseInt readLine stdin
echo s[n.pred mod 7]