#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
#define Pi 3.14159265358979
typedef long long Int;
typedef unsigned long long UInt;
typedef vector <int> VI;
typedef pair <int, int> PII;
int main()
{
int T;
cin>>T;
REP(tests,T)
{
int n;
cin>>n;
int res = -1;
for (int i = 0; i <= n; ++i)
{
if (i % 5 == 0)
{
int j = n - i;
if (j % 3 == 0)
{
res = i;
break;
}
}
}
if (res == -1)
{
cout << -1 << endl;
continue;
}
REP(i,n-res)
putchar('5');
REP(i,res)
putchar('3');
puts("");
}
return 0;
}
Sunday, February 9, 2020
SHERLOCK AND THE BEAST
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment