import sys import math import bisect from heapq import heapify, heappop, heappush from collections import deque, defaultdict, Counter from functools import lru_cache from itertools import accumulate, combinations, permutations, product sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD99 = 998244353 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(float, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() SMI = lambda: input().split() SLI = lambda: list(SMI()) EI = lambda m: [NLI() for _ in range(m)] def TSP(N, D, start, W): """ 巡回セールスマン問題 O(N^2*2^N) :param N: 頂点数 :param D: NxNの距離行列 :param start: 始点のindex :return: 最短距離 """ INF = 10**15 dp = [[INF] * (1<> i) & 1 == 0: w += W[i] for u in range(N): if dp[u][case] >= INF/2: continue for v in range(N): if (case >> v) & 1: continue dp[v][case|(1<