jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let S = readLine()!.toArray()
let alphabet = "abcdefghijklmnopqrstuvwxyz".toArray()
for c in alphabet {
    if !S.contains(c) {
        print(c)
        break
    }
    if c == "z" {
        print("None")
    }
}
//  [swift]
let alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
             "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
let main = {
  let s = readLine()!
  for c in alpha {
    if !s.contains(c) {
      print(c)
      return
    }
  }
  print("None")
}
main()
//  [typescript]
import * as fs from "fs";

let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const s = input[0];

const a = new Array(26).fill(0);
for (let c of s) {
	a[c.charCodeAt(0) - "a".charCodeAt(0)] += 1;
}

let flg = false;
for (let i = 0; i < 26; i++) {
	if (a[i] === 0) {
		console.log(String.fromCharCode("a".charCodeAt(0) + i));
		flg = true;
		break;
	}
}
if (!flg) {
	console.log("None");
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];

  for (let i = 97; i <= 122; i++) {
    const char = String.fromCodePoint(i);

    if (!S.includes(char)) {
      return char;
    }
  }

  return "None";
};

console.log(main(read()));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let s=ts().split('').sort()
  if(s[0]!='a'){
    to('a')
    return
  }
  for(let i=1;i<s.length-1;i++){
    if(s[i+1].charCodeAt(0)-s[i].charCodeAt(0)>1){
      to(String.fromCharCode(s[i].charCodeAt(0)+1))
      return
    }
  }
  to('None')
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let s=ts().split('').sort()
  if(s[0]!='a')to('a')
  for(let i=1;i<s.length-1;i++){
    if(s[i+1].charCodeAt(0)-s[i].charCodeAt(0)>1){
      to(String.fromCharCode(s[i].charCodeAt(0)+1))
      return
    }
  }
  to('None')
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let s=ts().split('').sort()
  for(let i=0;i<s.length-1;i++){
    if(s[i+1].charCodeAt(0)-s[i].charCodeAt(0)>1){
      to(String.fromCharCode(s[i].charCodeAt(0)+1))
      return
    }
  }
  to('None')
}
main()
//  [python]
def main():
    N = input()
    str_num = input()
    num_list = str_num.split()
    
    if '0' in num_list:
        print(0)
        return
    
    answer = 1
    for num in num_list:
        answer *=int(num)
        if answer > 10**18:
            answer = -1
            break

    print(answer)

main()
//  [python]
import sys

def main():
  N = int(input())
  P = sys.stdin.readline().rstrip().split()
  if '0' in P:
    print(0)
    return
  ans = 1
  for a in P:
    ans *= int(a)
    if ans > 1000000000000000000:
      print(-1)
      return
  print(ans)

if __name__ == "__main__":
    main()
//  [python]
import sys

def main():
    n = int(input())
    a=sys.stdin.readline().rstrip().split()
    if '0' in a:
        print(0)
        return
    ans=1
 
    for i in a:
        ans=ans*int(i)
        if ans>1000000000000000000:
            print("-1")
            return
    else:
        print(ans)
main()
//  [python]
n=int(input())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
    if l[i]==0:
        print('0')
        exit()
if m>k:
    print('-1')
else:
    print(m)
//  [python]
n=int(input())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
    if l[i]==0:
        print('0')
if k>m:
    print('-1')
else:
    print(m)
//  [python]
n=int(input())
l=list(map(int,input().split()))
k=10**18
m=1
for i in range(n):
    m *= l[i]
    if l[i]==0:
        print('0')
        exit()
print(min(m,k))
//  [java]
//master
import java.io.*;
import java.util.*;
public class Main {
    static int[][] memo;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        long[] a = new long[n];
        for(int i = 0; i<n; i++) {
            a[i] = sc.nextLong();
            if(a[i]==0) {
                p(0);
                return;
            }
        }
        long ans = 1;
        for(int i = 0; i<n; i++) {
            if(ans*a[i]>1000000000000000000L || ans> ans*a[i]) {
                p(-1);
                return;
            }
            ans *= a[i];
            
        }
        p(ans);
    }

    public static <T> void p(T message) {
        System.out.println(message);
    }

    public static <T> void pe(T message) {
        System.err.println(message);
    }

    public static <T> void pp(T message) {
        System.out.print(message);
    }
    
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    long[] a = new long[n];
    long ans = 1;
    long max = (long)Math.pow(10, 18);

    for(int i = 0; i < n; i++){
      a[i] = sc.nextLong();
      
        if(a[i] == 0){
          ans = 0;
          break;
        } else if(a[i] <= max / ans){
          ans *= a[i];
        } else {
          ans = -1;
          break;
        }
    }

    System.out.println(ans);
  }
}
//  [java]
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    long[] a = new long[n];
    long ans = 1;
    long max = (long)Math.pow(10, 18);

    for(int i = 0; i < n; i++){
      a[i] = sc.nextLong();
      
        if(a[i] == 0){
          ans = 0;
          break;
        } else if(ans <= max / a[i]){
          ans *= a[i];
        } else {
          ans = -1;
          break;
        }
    }

    System.out.println(ans);
  }
}
//  [java]
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    long[] a = new long[n];
    long ans = 1;
    long max = (long)Math.pow(10, 18);

    for(int i = 0; i < n; i++){
      a[i] = sc.nextLong();
      
        if(a[i] == 0){
          ans = 0;
          break;
        } else if(ans > max / a[i]){
          ans = -1;
          break;
        } else {
          ans *= a[i];
        }
    }

    System.out.println(ans);
  }
}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char S[2000020];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	fread(S, 1, 2000020, stdin);

	char* c = S, ct;
	int N = 0;
	
	while ((ct = *c++) >= '0') N = N * 10 + ct - '0';

	int L = 0, R = 2000001;
	while (L + 1 < R) {
		int M = (L + R) / 2;
		if (*(c + M) >= ' ') L = M;
		else R = M;
	}

	if (*c == '0') {
		printf("0\n");
		return 0;
	}

	for (char* d = c; d < c + R - 8; d += 7) {
		ll tmp = *(ll*)(d);
		tmp += 0x1010101010101010;
		tmp ^= 0xcfcfcfcfcfcfcfcf;

		ll tmp2 = tmp + 0x0001000100010001;
		if ((tmp2 << 1 ^ tmp2) & 0x2000200020002000) {
			printf("0\n");
			return 0;
		}
		tmp2 = tmp + 0x0000010001000100;
		if ((tmp2 << 1 ^ tmp2) & 0x0020002000200000) {
			printf("0\n");
			return 0;
		}
	}

	for (char* d = c + max(0, R - 10); d < c + R; d++) {
		if (*d == ' ' && *(d + 1) == '0') {
			printf("0\n");
			return 0;
		}
	}

	if (R >= N * 2 + 18) {
		printf("-1\n");
		return 0;
	}

	ll kotae = 1;
	auto owa = c + R;
	while (c < owa) {
		ll tmp = *(ll*)(c);
		if (tmp != 0x2031203120312031) {
			ll k = 0;
			while ((ct = *c++) >= '0') k = k * 10 + ct - '0';
			if (ll(1e18) / kotae < k) {
				printf("-1\n");
				return 0;
			}
			else kotae *= k;
		}
		else c += 8;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char S[2000020];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	fread(S, 1, 2000020, stdin);

	char* c = S, ct;
	int N = 0;
	
	while ((ct = *c++) >= '0') N = N * 10 + ct - '0';

	int L = 0, R = 2000001;
	while (L + 1 < R) {
		int M = (L + R) / 2;
		if (*(c + M) >= ' ') L = M;
		else R = M;
	}

	if (*c == '0') {
		printf("0\n");
		return 0;
	}

	for (char* d = c; d < c + R - 8; d += 7) {
		ll tmp = *(ll*)(d);
		tmp += 0x1010101010101010;
		tmp ^= 0xcfcfcfcfcfcfcfcf;
		ll tmp2 = tmp + 0x0001000100010001;
		tmp = tmp + 0x0000010001000100;

		if (((tmp << 1 ^ tmp) & 0x0020002000200000) | ((tmp2 << 1 ^ tmp2) & 0x2000200020002000)) {
			printf("0\n");
			return 0;
		}
	}

	for (char* d = c + max(0, R - 10); d < c + R; d++) {
		if (*d == ' ' && *(d + 1) == '0') {
			printf("0\n");
			return 0;
		}
	}

	if (R >= N * 2 + 18) {
		printf("-1\n");
		return 0;
	}

	ll kotae = 1;
	auto owa = c + R;
	while (c < owa) {
		ll tmp = *(ll*)(c);
		if (tmp != 0x2031203120312031) {
			ll k = 0;
			while ((ct = *c++) >= '0') k = k * 10 + ct - '0';
			if (ll(1e18) / kotae < k) {
				printf("-1\n");
				return 0;
			}
			else kotae *= k;
		}
		else c += 8;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}
//  [cpp]
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char S[2000020];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	fread(S, 1, 2000020, stdin);

	char* c = S, ct;
	int N = 0;
	
	while ((ct = *c++) >= '0') N = N * 10 + ct - '0';

	int L = 0, R = 2000001;
	while (L + 1 < R) {
		int M = (L + R) / 2;
		if (*(c + M) >= ' ') L = M;
		else R = M;
	}

	if (*c == '0') {
		printf("0\n");
		return 0;
	}

	int zero = 0;
	int n = R / 8 + 1;
	for (char* d = c; d < c + R - 8; d += 7) {
		ll tmp = *(ll*)(d);
		tmp += 0x1010101010101010;
		tmp ^= 0xcfcfcfcfcfcfcfcf;

		ll tmp2 = tmp + 0x0001000100010001;
		if ((tmp2 << 1 ^ tmp2) & 0x2000200020002000) {
			printf("0\n");
			return 0;
		}
		tmp2 = tmp + 0x0000010001000100;
		if ((tmp2 << 1 ^ tmp2) & 0x0020002000200000) {
			printf("0\n");
			return 0;
		}
	}

	for (char* d = c + min(0, R - 10); d < c + R; d++) {
		if (*d == ' ' && *(d + 1) == '0') {
			printf("0\n");
			return 0;
		}
	}

	if (R >= N * 2 + 18) {
		printf("-1\n");
		return 0;
	}

	ll kotae = 1;
	auto owa = c + R;
	while (c < owa) {
		ll tmp = *(ll*)(c);
		if (tmp != 0x2031203120312031) {
			ll k = 0;
			while ((ct = *c++) >= '0') k = k * 10 + ct - '0';
			if (ll(1e18) / kotae < k) {
				printf("-1\n");
				return 0;
			}
			else kotae *= k;
		}
		else c += 8;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}
//  [cpp]
#include<stdio.h>

#define limit 1000000000000000000

int main()
{
    long long int a[100000],i,n,pro;

    scanf("%lld",&n);

    for(i=0,pro=1;i<n;i++)
    {
        scanf("%lld",&a[i]);

    }

    for(i=0;i<n;i++)
    {
        if(pro>limit/a[i])
        {
            printf("-1");
            return 0;
        }

        else
            pro = pro * a[i];

    }


    printf("%lld",pro);
    return 0;
}
//  [cpp]
 #include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  
  int sum = 1;
  
  for(int i = 0; i < N;i++){
    int A;
    cin >> A;
    sum *= A;
  }
  cout << sum << endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  
  int sum = 1;
  
  for(int i = 0;i < N;i++){
    int A;
    cin >> A;
    sum *= A;
  }
  if(sum < 1000000000000000000){
    cout << sum << endl;
  }else{
    cout << -1 << endl;
  }
}
//  [c]
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

char bufr[2000007];
int bufrl;

#define getchar_unlocked() bufr[bufrl++]

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

int main(void){
	read(STDIN_FILENO, bufr, sizeof(bufr));
	int n=nextint();
	long ans=1;
	bool f=false;
	for(int i=0; i<n; i++){
		long a=nextlong();
		if(a==0){
			f=false;
			ans=0;
			break;
		}
		if(!f){
			if(__builtin_smull_overflow(ans, a, &ans) || ans>1000000000000000000L){
				f=true;
			}
		}
	}
	printf("%ld\n", f?-1:ans);
}
//  [c]
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

int main(void){
	int n=nextint();
	long ans=1;
	bool f=false;
	for(int i=0; i<n; i++){
		long a=nextlong();
		if(a==0){
			f=false;
			ans=0;
			break;
		}
		if(!f){
			if(__builtin_smull_overflow(ans, a, &ans) || ans>1000000000000000000L){
				f=true;
			}
		}
	}
	printf("%ld\n", f?-1:ans);
}
//  [c]
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }

int main(void){
	int n=nextint();
	long ans=1;
	bool f=false;
	for(int i=0; i<n; i++){
		long a=nextlong();
		if(a==0){
			f=false;
			ans=0;
			break;
		}
		if(!f){
			if(__builtin_smull_overflow(ans, a, &ans)){
				f=true;
			}else if(ans>1000000000000000000L){
				f=true;
			}
		}
	}
	printf("%ld\n", f?-1:ans);
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <math.h>
#pragma warning(disable : 4996)

int main()
{
    long long a[10010];
    long n;
    scanf("%ld", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

        for (int i = 0; i < n; i++){
            if (a[i] == 0) {
                printf("0");
                return 0;
            }
    }

    long long ans = 1;

    for (int i = 0; i < n; i++) {
        if (ans <= 1000000000000000000 / a[i]) {
            ans *= a[i];
        }
        else {
            printf("-1");
            return 0;
        }
    }

    printf("%lld", ans);

    return 0;

}
//  [c]
#include <stdio.h>
#include <string.h>
#include <math.h>
#pragma warning(disable : 4996)

int main()
{
    long long a[10010];
    long n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

        for (int i = 0; i < n; i++){
            if (a[i] == 0) {
                printf("0");
                return 0;
            }
    }

    long long ans = 1;

    for (int i = 0; i < n; i++) {
        if (a[i] <= 1000000000000000000 / ans) {
            
            ans *= a[i];
        }
        else {
            printf("-1");
            return 0;
        }
    }

    printf("%lld", ans);

    return 0;

}
//  [c]
#include <stdio.h>

int main()
{
    int N, i;
    scanf("%d",&N);

    unsigned long long int A[N], mul=1;

    for(i=0; i<N; i++)
    {
        scanf("%lld",&A[i]);
        mul = mul*A[i];
    }
    if(mul <= 1000000000000000000)
    {
        printf("%lld\n",mul);
    }
    else
        printf("-1\n");

    return 0;
}
//  [javascript]
const main = (input) => {
	const args = input.trim().split("\n");
	const N = args[0]
	const As = args[1].trim().split(" ")
	let flag = ''
	if (As.includes('0')) { flag = 'zero' }
	let answer = As[0]

	const limit = 10 ** 18
	if (flag !== 'zero') {
		let i = 1;
		while (i < As.length) {
			if (answer <= limit) {
				answer = BigInt(answer) * BigInt(As[i])
				i = (i + 1) | 0
				if (answer > limit) {
					flag = 'over'
					break
				}
			}
		}
	}
	switch (flag) {
		case 'zero' :
			console.log(0)
			break
		case 'over':
			console.log(-1)
			break
		default:
			console.log(answer.toString())
	}
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  var ans = 1n;
  var mx = 1000000000000000000n;
  var a = nexts(n,1);
  for(var i = 0; i < n; i++){
    if(a[i] === "0")return 0;
  }
  for(var i = 0; i < n; i++){
    ans *= BigInt(a[i]);
    if(ans > mx)return -1;
  }
  return ans.toString();
}
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const rows = input.split("\n")
const N = parseInt(rows[0], 10)
const values = rows[1].split(" ")
var sum = BigInt(values[0]);
function multi () {
    for (var i = 1; i < N; i ++) {
        sum *= BigInt(values[i])
        if (sum > 1000000000000000000) {
            return -1
        }
    }
    return sum
}
if (values.find(value => value === '0')) {
    console.log(0)
} else {
    console.log(multi().toString().replace('n', ''))
}
//  [javascript]
const main = stdin => {
  const input = stdin.trim().split('\n')
  const N = parseInt(input[0])
  const nums = input[1].split(' ').map(x => BigInt(x))
  let ans = 1n
  for (let i = 0; i < N; i++) {
    ans = ans * nums[i]
  }
  if (ans > 1000000000000000000n) {
    console.log(-1)
  } else {
    console.log(ans.toString())
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0]);
  const A = input[1].split(" ");

  let answer = BigInt(A[0]);
  let B = [];
  for (let i = 0; i < N; i++) {
    B[i] = BigInt(A[i]);
  }

  if (A.indexOf("0") === -1) {
    for (let i = 1; i < N; i++) {
      answer = answer * B[i];
      if (answer > BigInt(10 ** 18)) {
        answer = -1;
        break;
      }
    }
  } else {
    answer = parseInt(0);
  }


  console.log(parseInt(answer));
}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0]);
  const A = input[1].split(" ");

  let answer = BigInt(A[0]);
  let B = [];
  for (let i = 0; i < N; i++) {
    B[i] = BigInt(A[i]);
  }

  if (A.indexOf("0") === -1) {
    for (let i = 1; i < N; i++) {
      answer = answer * B[i];
      if (answer > BigInt(10 ** 18)) {
        answer = -1;
        break;
      }
    }
  } else {
    answer = parseInt(0);
  }


  console.log(answer);
}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"io"
	"math/big"
	"os"
)

func main() {
	sc := NewScanner(os.Stdin)
	n := sc.Int()
	a := make([]int64, n)

	for i := range a {
		a[i] = sc.Int64()
		if a[i] == 0 {
			fmt.Println(0)
			return
		}
	}

	res := big.NewInt(1)
	max := big.NewInt(1000000000000000000)

	for _, v := range a {
		res = res.Mul(res, big.NewInt(v))
		if res.Cmp(max) == 1 {
			fmt.Println(-1)
			return
		}
	}

	fmt.Println(res)
}

// generated by https://github.com/murosan/gollect

type Scanner struct {
	r     io.Reader
	buf   []byte
	delim byte
	size, eof,
	start, end int
}

func NewScanner(r io.Reader) *Scanner { return NewScannerSize(r, 4096) }
func NewScannerSize(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:     r,
		buf:   make([]byte, size),
		delim: ' ',
		size:  size, start: size, end: size,
	}
}

func (s *Scanner) Int() int     { return ParseInt(s.bytes()) }
func (s *Scanner) Int64() int64 { return ParseInt64(s.bytes()) }

func (s *Scanner) bytes() []byte { b, _ := s.next(); return b }
func (s *Scanner) next() (b []byte, size int) {
	for n := 0; ; {
		for i := s.end; i < s.size; i++ {
			if s.buf[i] == s.delim || s.buf[i] == '\n' || i == s.eof {
				b, size = s.buf[s.start:i], i-s.start
				s.start, s.end = i+1, i+1
				return
			}
		}
		s.end = s.size
		if n++; n == 2 {
			panic("lack of buffer size")
		}
		s.read()
	}
}
func (s *Scanner) read() {
	copy(s.buf, s.buf[s.start:s.end])
	s.end -= s.start
	s.start = 0
	n, _ := s.r.Read(s.buf[s.end:])
	s.eof = s.end + n
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}

func ParseInt64(b []byte) (n int64) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int64(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}
//  [go]
package main

import (
	"fmt"
	"io"
	"math/big"
	"os"
)

func main() {
	sc := NewScanner(os.Stdin)
	n := sc.Int()
	a := sc.Int64s(n)

	for _, v := range a {
		if v == 0 {
			fmt.Println(0)
			return
		}
	}

	res := big.NewInt(1)
	max := big.NewInt(1000000000000000000)

	for _, v := range a {
		res = res.Mul(res, big.NewInt(v))
		if res.Cmp(max) == 1 {
			fmt.Println(-1)
			return
		}
	}

	fmt.Println(res)
}

// generated by https://github.com/murosan/gollect

type Scanner struct {
	r     io.Reader
	buf   []byte
	delim byte
	size, eof,
	start, end int
}

func NewScanner(r io.Reader) *Scanner { return NewScannerSize(r, 4096) }
func NewScannerSize(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:     r,
		buf:   make([]byte, size),
		delim: ' ',
		size:  size, start: size, end: size,
	}
}

func (s *Scanner) Int() int     { return ParseInt(s.bytes()) }
func (s *Scanner) Int64() int64 { return ParseInt64(s.bytes()) }

func (s *Scanner) Int64s(len int) []int64 {
	a := make([]int64, len)
	for i := 0; i < len; i++ {
		a[i] = s.Int64()
	}
	return a
}

func (s *Scanner) bytes() []byte { b, _ := s.next(); return b }
func (s *Scanner) next() (b []byte, size int) {
	for n := 0; ; {
		for i := s.end; i < s.size; i++ {
			if s.buf[i] == s.delim || s.buf[i] == '\n' || i == s.eof {
				b, size = s.buf[s.start:i], i-s.start
				s.start, s.end = i+1, i+1
				return
			}
		}
		s.end = s.size
		if n++; n == 2 {
			panic("lack of buffer size")
		}
		s.read()
	}
}
func (s *Scanner) read() {
	copy(s.buf, s.buf[s.start:s.end])
	s.end -= s.start
	s.start = 0
	n, _ := s.r.Read(s.buf[s.end:])
	s.eof = s.end + n
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}

func ParseInt64(b []byte) (n int64) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int64(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var limit uint64 = 1

func init() {
	for i := 0; i < 18; i++ {
		limit *= 10
	}
}

func main() {
	N := readlineint()[0]
	In := readlineint()

	for _, v := range In {
		if v == 0 {
			fmt.Println("0")
			return
		}
	}

	var previous_result uint64 = 1
	var result uint64 = 1
	for i := 0; i < N; i++ {
		previous_result = result
		result *= uint64(In[i])

		if result > limit || previous_result > result {
			fmt.Println("-1")
			return
		}
	}
	fmt.Println(result)
}

/////////////////////////////////////////

func fln(format string, elements ...interface{}) {
	fmt.Printf(format+"\n", elements...)
}

var bufreader = bufio.NewReaderSize(os.Stdin, 1e6)

func readline() string {
	a, _, _ := bufreader.ReadLine()
	return string(a)
}

func readlineint() (result []int) {
	in := strings.Split(readline(), " ")
	result = make([]int, 0, 2)
	for _, v := range in {
		t, _ := strconv.Atoi(v)
		result = append(result, t)
	}
	return
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextLine(r *bufio.Reader) string {
	var buf []byte
	for {
		line, isPrefix, err := r.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func nextStr(s *bufio.Scanner) string {
	s.Scan()
	ref := s.Bytes()
	cp := make([]byte, len(ref))
	copy(cp, ref)
	return string(cp)
}

func nextInt(s *bufio.Scanner) int {
	n, err := strconv.Atoi(nextStr(s))
	if err != nil {
		panic(err)
	}
	return n
}

func nextInt64(s *bufio.Scanner) int64 {
	n, err := strconv.ParseInt(nextStr(s), 0, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	N := nextInt(s)

	var prod int64 = 1
	x := make([]int64, N)
	for i := 0; i < N; i++ {
		x[i] = nextInt64(s)
		if x[i] == 0 {
			fmt.Println(0);
			return;
		}
	}

	for i := 0; i < N; i++ {
		if (2e18 / prod < x[i]) {
			fmt.Println(-1)
			return
		}
		prod *= x[i]
	}

	fmt.Println(prod)
}
//  [ruby]
a = gets.to_i
line = gets.split(' ').map(&:to_i)
if line.include?(0)
  puts 0
else
  i= 1
  for n in 0..a-1 do
    i *= line[n]
    if i > 1000000000000000000
    	i = -1
    	puts i
      	exit
  	end
  end
  puts i
end
//  [ruby]
n = gets.to_i
a = gets.split(" ").map(&:to_i)

ans = 1
if !a.index(0).nil?
  p 0
  exit
end
a.each do |b|
  ans *= b
  if ans > 10 ** 18
    p -1
    exit
  end
end
p ans
//  [ruby]
line = $stdin.read.split(' ')
all_numbers = line[1..-1].map(&:to_i)
if all_numbers.include?(0)
  puts 0
else
  result = 1
  all_numbers.each do |number|
    result = result * number
    break if result > 10**18
  end
  if result > 10**18
    puts '-1'.to_i
  else
    puts result
  end
end
//  [ruby]
n = gets.to_i
a = gets.split(" ").map(&:to_i)
i = 0
res = 1

if a.include?("0")
 puts 0
 return
end

while i < a.length do
  res = res * a[i]
  if res > 10 ** 18
    puts "-1"
    return
  end
  i += 1
end

puts res
//  [rust]
fn main() {
	use std::io::Read;
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let _: usize = s.by_ref().next().unwrap().parse().unwrap();
	let ans = s.map(|s| s.parse::<i64>().unwrap()).fold(1i64, |r, a| r.saturating_mul(a));
	println!("{}", if ans > 1000000000000000000 { -1 } else { ans });
}
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [isize; n],
    }
    a.sort();

    let mut ans = if a.len() == 0 { 0 } else { 1 };

    for i in 0..n {
        ans *= a[i];
        if ans == 0 {
            break;
        }
        if 1_000_000_000_000_000_000 < ans {
            ans = -1;
            break;
        }
    }

    println!("{}", ans);
}
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [isize; n],
    }
    a.sort();

    let mut ans = 1;

    for i in 0..n {
        ans *= a[i];
        if ans == 0 {
            break;
        }
        if 1_000_000_000_000_000_000 < ans {
            ans = -1;
            break;
        }
    }

    println!("{}", ans);
}
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u128; n],
    }

    let ans = a.iter().fold(1, |sum, x| sum * x);

    println!("{}", if ans <= 1_000_000_000_000_000_000 { ans.to_string() } else { (-1).to_string() });
}
//  [swift]
func readUInts() -> [UInt] {
    return readLine()!.split(separator: " ").map { UInt($0)! }
}

func main() {
    let _ = readLine()!
    let a_tachi = readUInts().sorted(by: <)
    
    if a_tachi[0] == 0 {
        print(0)
        return
    }
    
    var mul: UInt = 1
    for a in a_tachi {
        if 1000000000000000000 / mul < a {
            print(-1)
            return
        }
        mul *= a
        if mul > 1000000000000000000 {
            print(-1)
            return
        }
    }
    
    print(mul)
}

main()
//  [swift]
// Multiplication 2

func main() {
    let _ = Int(readLine()!)!
    let a = readLine()!.split(separator: " ").map{Int($0)!}
    if a.contains(0) {
        print(0)
        return
    }
    var result = 1
    for ai in a {
        result *= ai
        if result > 1000000000000000000 {
            print(-1)
            return
        }
    }
    print(result)
}

main()
//  [swift]
import Foundation

func readInts() -> [Int] {
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let _ = Int(readLine()!)!
    let numbers = readInts()
    var ans = 1
    
    if numbers.contains(0){
        print(0)
        return
    }
    for n in numbers {
        let x = ans &* n
        
        if x > Int.max || ans * n > 1000000000000000000{
            print(-1)
            return
        }

        ans *= n
    }
    print(ans)
}
main()
//  [swift]
import Foundation

func readInts() -> [Int] {
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let _ = Int(readLine()!)!
    let numbers = readInts()
    var ans = 1
    
    if numbers.firstIndex(of: 0) != nil{
        print(0)
        return
    }
    for n in numbers {
        ans *= n
        if ans > 1000000000000000000{
            print(-1)
            return
        }
    }
    print(ans)
}
main()
//  [typescript]
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);
const readBigInt = () => BigInt(readString());

const gcd = (a: bigint, b: bigint) => {
  const _gcd = (a: bigint, b: bigint): bigint => {
    const q = a % b;
    return q === 0n ? b : _gcd(b, q);
  };
  return a > b ? _gcd(a, b) : _gcd(b, a);
};

const MOD = 1000000007;
const MOD_BIGINT = BigInt(MOD);
class ModBigInt {
  constructor(public v: bigint) {}

  static of(n: number | bigint) {
    return new ModBigInt(ModBigInt.toBigInt(n));
  }

  static toBigInt(other: number | bigint | ModBigInt) {
    if (typeof other === 'bigint') return other;
    if (typeof other === 'number') return BigInt(other);
    return other.v;
  }

  clone = () => new ModBigInt(this.v);
  plus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  minus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + MOD_BIGINT - ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  multiply = (other: number | bigint | ModBigInt) => {
    this.v = (this.v * ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  pow = (other: number) => {
    const v = mod(1);
    for (let i = 0; i < other; i++) v.multiply(this.v);
    return v;
  };
}

const mod = ModBigInt.of;

const abs = (a: bigint) => (a > 0n ? a : -a);

(function main() {
  const N = readInt();
  const A = Array(N).fill(0).map(readBigInt);
  for (let i = 0; i < N; i++) {
    if (A[i] === 0n) {
      console.log(0);
      process.exit(0);
    }
  }

  const max = 10n ** 18n;
  let result = 1n;
  for (let i = 0; i < N; i++) {
    result *= A[i];
    if (result > max) {
      console.log(-1);
      process.exit(0);
    }
  }
  console.log(result.toString());
})();
//  [typescript]
import  * as fs from 'fs';
const [noUse, inp] = fs.readFileSync("/dev/stdin", "utf8").split("\n");

const a: bigint[] = inp.split(" ").map((s: string) => BigInt(s));
if (a.includes(BigInt(0))) {
    console.log(0);
    process.exit(0);
}

let ans: bigint = BigInt(1);
a.forEach((n: bigint) => {
    ans = BigInt(ans) * BigInt(n);
    if (ans > Math.pow(10, 18)) {
        console.log(-1);
        process.exit(0);
    }
});

console.log(ans.toString());
//  [typescript]
const [_, inp] = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const a: bigint[] = inp.split(" ").map((s: string) => BigInt(s));
if (a.includes(BigInt(0))) {
    console.log(0);
    process.exit(0);
}

let ans: bigint = BigInt(1);
a.forEach((n: bigint) => {
    ans = BigInt(ans) * BigInt(n);
    if (ans > Math.pow(10, 18)) {
        console.log(-1);
        process.exit(0);
    }
});

console.log(ans.toString());
//  [python]
s = raw_input()
print s[0] + str(len(s[1:-1])) + s[-1]
//  [python]
s = input()
print(s[0] + str(len(s)-2) + s[-1])
//  [python]
s = input()
print(s[0] + str(len(s) - 2) + s[-1])
//  [python]
s = input()
print(s[0]+str(lent(s)-2)+s[-1])
//  [python]
s = input()
print(s[0]+s.str(lent(s)-2)+s[-1])
//  [python]
print(s[0]+s.count(s-2)+s[-1])
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String str = br.readLine();
            int length = str.length();
            System.out.print(str.substring(0, 1));
            System.out.print(length - 2);
            System.out.println(str.substring(length - 1, length));
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}
//  [java]
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int length = str.length();
		System.out.println(str.substring(0,1) + "" + (length - 2) + "" + str.substring(length - 1, length));
		
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		System.out.println(s.charAt(0) + (s.length() - 2) + s.charAt(s.length() - 1));

		sc.close();

	}

}
//  [java]
package cp;

import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();		
		String s = r.str();		
		print(""+s.charAt(0) + (s.length()-2) +s.charAt(s.length()-1));
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}
	
	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}
	
	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}
		
		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}
//  [java]
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	char[] ch=sc.next().toCharArray();
    int n=ch.length;
    System.out.println(ch[0]+(n-2)+ch[n-1]);
  }
}
//  [cpp]
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define FOR(i,s,e) for (int i=s;i<e;i++)
#define FOE(i,s,e) for (int i=s;i<=e;i++)
#define FOD(i,s,e) for (int i=s;i>=e;i--)
#define SET(a,e) memset(a,e,sizeof(a))
#define LL long long
#define LD long double
#define pb push_back
#define x first
#define y second
#define PII pair<int,int>
#define PLI pair<LL,int>
#define PIL pair<int,LL>
#define PLL pair<LL,LL>
#define eps 1e-9
#define mp make_pair

char s[105];
int n;

int main () {
	scanf("%s",s);
	n=strlen(s);
	printf("%c%d%c",s[0],n-2,s[n-1]);
	return 0;	
}
//  [cpp]
#include<stdio.h>
#include<string.h>
int main(){
	char s[105];
	scanf("%s",s);
	printf("%c%d%c\n",s[0],strlen(s)-2,s[strlen(s)-1]);
}
//  [cpp]
#include <cstdio>
#include <cstring>
using namespace std;
char s[1010];
int main()
{
	scanf("%s",s);
	printf("%c%d%c",s[0],strlen(s) - 2,s[strlen(s) - 1]);
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  int a,b;
  
  cin >> s;
  cout << s[0] + s.size()+s[s.size()-1] << endl;
  
}
//  [cpp]
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	string s;
	cin >> s;
	cout << s[0] << s.length() << s[s.length()-1] << endl;
}
//  [cpp]
#include <string>
#include <iostream>
using namespace std;
int main()
{
  string s;
  cin >> s;
  cotu << s[0] << s.length()-2 << s[s.length()-1];
  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
int main(void){
	char s[101];
	scanf("%s",&s);
	printf("%c%d%c",s[0],strlen(s)-2,s[strlen(s)-1]);
	return 0;
}