#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=1000000007; constexpr ll INF=2e18; int main(){ string s; cin >> s; ll n; cin >> n; string t="CpCzNkSuTbEoA"; for(auto c:s){ if(c>='0'&&c<='9'){ if(n-10+c-'0'<0) cout << (char)(c+n); else{ for(auto d:t){ if(d>='a'&&d<='z') cout << (char)('a'+(d-'a'+(n-10+c-'0')%26)%26); else cout << (char)('A'+(d-'A'+(n-10+c-'0')%26)%26); } } } else if(c>='a'&&c<='z') cout << (char)('a'+(c-'a'+n%26)%26); else cout << (char)('A'+(c-'A'+n%26)%26); } return 0; }