#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) KLD = np.array(read().split(), np.int64) K = KLD[::3] L = KLD[1::3] D = KLD[2::3] D = 1 << D