#include using namespace std; int N,A[18],B[18]; int cost[18][18],dp[1<<18]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i>A[i]>>B[i]; for(int i=0;i>k&1){ for(int l=0;l>l&1)){ dp[j|1<