#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); #define RD(v) v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define RD_SINT(v) v=0;{int s=*rp==45?++rp,1:0;int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;v=s?-v:v;} long z=-1l<<62; long h[1<<18]; int y; int n; int a[18],b[18][18]; void f(int i,int d,int long s){ if(d