#include using namespace std; int main(){ int N,M; cin >> N >>M; if(M==0){cout<<1;return 0;} N%=10; M=M%4+4; int ans=1; int i; for(i=0;i