def METHOD_NAME(distance_matrix, backend=None):
    num_cities = distance_matrix.shape[0]
    two_to_one = calculate_two_to_one(num_cities)
    form = 0
    for i in range(num_cities):
        for u in range(num_cities):
            for v in range(num_cities):
                if u != v:
                    form += (
                        distance_matrix[u, v]
                        * Z(int(two_to_one[u, i]))
                        * Z(int(two_to_one[v, (i + 1) % num_cities]))
                    )
    ham = SymbolicHamiltonian(form, backend=backend)
    return ham