Gena's Code
It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from each country, find their product. If it is turns to be too large, then the servers might have not enough time to assign tanks into teams and the whole game will collapse!There are exactly n distinct countries in the world and the i-th country added ai tanks to the game. As the developers of the game are perfectionists, the number of tanks from each country is beautiful. A beautiful number, according to the developers, is such number that its decimal representation consists only of digits '1' and '0', moreover it contains at most one digit '1'. However, due to complaints from players, some number of tanks of one country was removed from the game, hence the number of tanks of this country may not remain beautiful.Your task is to write the program that solves exactly the same problem in order to verify Gena's code correctness. Just in case.
In sample 1 numbers 10 and 1 are beautiful, number 5 is not not.In sample 2 number 11 is not beautiful (contains two '1's), all others are beautiful.In sample 3 number 3 is not beautiful, all others are beautiful.
The first line of the input contains the number of countries n (1 ≤ n ≤ 100 000). The second line contains n non-negative integers ai without leading zeroes — the number of tanks of the i-th country.It is guaranteed that the second line contains at least n - 1 beautiful numbers and the total length of all these number's representations doesn't exceed 100 000.
Print a single number without leading zeroes — the product of the number of tanks presented by each country.
import math

def main():
    input()
    nr_zeroes = 0
    a = map(str, input().split())
    nr_zeroes = 0
    nb = str(1)
    for nr in a:
        if nr == '1':
            continue
        if nr == '0':
            return 0
        nr_ones = nr.count('1')
        if nr_ones > 1 or set(nr) != {'1', '0'}:
            nb = nr
        else:
            nr_zeroes += nr.count('0')
    return nb + '0' * nr_zeroes
if __name__ == '__main__':
    print(main())
import os, sys
from io import BytesIO, IOBase
from math import *

def main():
    t = int(input())
    arr = Sarr()
    flag = False
    ans = '1'
    count = 0
    for x in arr:
        n = len(x)
        if n == 1:
            if x == '0':
                flag = True
                break
            elif x != '1':
                ans = x
        elif ans == '1':
            cek = x[0] == '1'
            if cek:
                for item in x[1:]:
                    cek = item == '0'
                    if not cek:
                        break
            if not cek:
                ans = x
            else:
                count += n - 1
        else:
            count += n - 1
    if flag:
        print(0)
    else:
        print(ans + '0' * count)
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            (self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            (self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            (self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda : self.buffer.read().decode('ascii')
        self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
Iarr = lambda : list(map(int, input().split()))
Sarr = lambda : list(map(str, input().split()))
if __name__ == '__main__':
    main()
def check(x):
    if x[0] != '1':
        return True
    for i in x[1:]:
        if i != '0':
            return True
    return False
n = int(input())
a = input().split()
count1 = 0
result = ''
for i in a:
    if i == '0':
        print(0)
        exit()
    if i == '1':
        continue
    if check(i):
        result = i
    else:
        count1 += len(i) - 1
if result == '':
    print('1' + '0' * count1)
else:
    print('%s' % result + '0' * count1)