#include<iostream> using namespace std; int main() { int s,w; cin>>s>>w; if(s==1) {if(w==1) cout<<8; else cout<<w+7;} else {if(w==1) cout<<10; else cout<<10+2*(w-1);} }