結果
| 問題 | 
                            No.1237 EXP Multiple!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ayaoni
                         | 
                    
| 提出日時 | 2020-10-17 09:49:13 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 97 ms / 2,000 ms | 
| コード長 | 448 bytes | 
| コンパイル時間 | 992 ms | 
| コンパイル使用メモリ | 82,064 KB | 
| 実行使用メモリ | 107,376 KB | 
| 最終ジャッジ日時 | 2024-07-21 01:53:23 | 
| 合計ジャッジ時間 | 3,162 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 19 | 
ソースコード
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
N = I()
A = LI()
m = 10**9+7
if min(A) == 0:
    print(-1)
    exit()
if max(A) >= 4:
    print(m)
else:
    x = 1
    for a in A:
        if a == 2:
            x *= 4
        if a == 3:
            x *= 729
        if x > m:
            print(m)
            break
    else:
        print(m % x)
            
            
            
        
            
ayaoni