print "7894561230"[input()]