#include using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i=b;i--) vector>> dp; vector A; string S; ll solve(ll i,ll k,ll p) { if(i==0) { if(k==0&&p==0) return 1; else return 0; } if(dp[i][k][p+360]!=-1) { return dp[i][k][p+360]; } ll s=0; if(k==0) { s+=solve(i-1,k,p); } else{ for(ll j=i-1;j>=0;j--) { s+=solve(j,k-1,A[k-1]-j+p); } } dp[i][k][p+360]=s; return s; } int main() { cin>>S; ll N=0; for(ll i=0;i (N); ll now=0; for(ll i=0;i>> (S.size()+1,vector> (N+1,vector (721,-1))); dp[0][0][0]=1; cout<