#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const pair&p){ os< ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os<>n; vector v; while(n){ int x=n%5; if(x<0) x+=5; if(x>=3) x=x-5; v.push_back(x); n=(n-x)/5; } reverse(ALL(v)); // digit, less, plus, diff ll dp[30][3][3][200]={}; dp[0][0][0][80]=1; // less auto fj=[&](int x,int put,int idx){ if(idx) return idx; if(put==x) return 0; if(put