import sequtils,strutils,algorithm,math,sugar,macros,strformat echo "285714"[(stdin.readline().parseInt()+5) mod 6]