import os,sys,random,threading from random import randint,choice,shuffle from copy import deepcopy from io import BytesIO,IOBase from types import GeneratorType from functools import lru_cache,reduce from bisect import bisect_left,bisect_right from collections import Counter,defaultdict,deque from itertools import accumulate,combinations,permutations from heapq import heapify,heappop,heappush from typing import Generic,Iterable,Iterator,TypeVar,Union,List from math import sqrt from decimal import Decimal,getcontext from sys import stdin, stdout, setrecursionlimit input = lambda: sys.stdin.readline().rstrip("\r\n") MI = lambda :map(int,input().split()) li = lambda :list(MI()) ii = lambda :int(input()) mod = 10**9+7 inf = 1<<64 mod=998244353 def popcnt(n): c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555) c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333) c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f) c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff) c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff) c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff) return c def inv(x): return pow(x,mod-2,mod) n=ii() f=li() tot=sum(f) it=inv(tot) for i in range(n): for s in range(1<>i&1==1: f[s]+=f[s^(1<>i&1: c[s]+=c[s^(1<