#include<iostream> using namespace std; int main(){ int D; cin>>D; if((D+2)%7==0) cout<<7; else cout<<(D+2)%7; return 0; }