#include #include #include #include #include #include using namespace std; const int inf=1e9; string st; int dp[110][15][15]; int DP(int len,int x,int y){ if(len==0) return 0; if(dp[len][x][y]!=-1) return dp[len][x][y]; int ans=inf,pos=st[st.length()-len]-'0'; if(pos==0) pos=10; for(int i=0;i>st){ memset(dp,-1,sizeof(dp)); cout<