# Arup Guha
# 8/21/2026
# Solution to 2026 UCF Locals Problem: You Make the Data

# Returns a frequency array of digits in number x.
def freq(x):

    s = str(x)
    f = [0]*10
    for z in s:
        f[ord(z)-ord('0')]+=1
    return f

# Returns true iff the frequency arrays f1 and f2 are equal.
def equal(f1,f2):

    for i in range(len(f1)):
        if f1[i] != f2[i]:
            return False
    return True

# Returns true iff the numbers x and y don't have any matching digits
# in the same spot.
def derange(x,y):
    s = str(x)
    t = str(y)
    for i in range(len(s)):
        if s[i] == t[i]:
            return False
    return True

'''
The basis my code generated:

125874
1052874
10524789
105236784
1052346789
10521256284

'''
def genbasis():

    # Just stores powers of 10.
    start = 100000

    # The answers we need to brute force.
    for d in range(6,12):

        # Can't be bigger than this.
        end = 5*start

        # After running this slowing for 3 or 4 iterations, I realized that except
        # for the first number the answer always started 1052, so I decided to speed
        # up my search!
        realStart = start + start//20 + start//500

        # It won't go anywhere near end.
        for x in range(realStart, end):
            f1 = freq(x)
            f2 = freq(2*x)

            # We found something!
            if equal(f1,f2) and derange(x,2*x):
                print(x)
                break

        # Just go to next power of 10.
        start = 10*start

# Actual solution
def main():

    BASIS = [125874,1052874,10524789,105236784,1052346789,10521256284]
    
    # Get input.
    n = int(input())

    # Can't be done - a brute force search can establish this.
    if n < 6:
        print(-1)

    # Otherwise, we print one item in the BASIS list (based on length mod 6)
    # Followed by the necessary copies of BASIS[0]
    else:
        print(BASIS[n%6],end="")
        print( str(BASIS[0])* (n//6 - 1) )

# Run it.
main()
        

    
