#!/usr/bin/python3

'''
A script to find 9 digit pandigital products
'''

def isPandigital(num):
    if sorted(str(num)) == sorted('123456789'):
        return True
    else:
        return False

def check_for_pan():
    prods=[]
    for i in range(1,10):
        for j in range(1000,10000):
            if isPandigital(str(i)+str(j)+str(i*j)):
                prods.append(i*j)
    for i in range(10,100):
        for j in range(100,1000):
            if isPandigital(str(i)+str(j)+str(i*j)):
                prods.append(i*j)
    return sum(set(prods))

print(check_for_pan())
