import math max_data = int(input()) k_data = int(input()) yakusu = int(math.sqrt(k_data)) yakusu_fir=0 yakusu_sec=0 result =0 result_f = 0 result_s = 0 for yakusu_i in range(2,yakusu+1): if k_data%yakusu_i == 0: yakusu_fir = yakusu_i yakusu_sec = int(k_data/yakusu_i) for a_in in range(1,max_data+1): for c_in in range(1,max_data+1): if int(a_in+c_in)==yakusu_fir: result_f = result_f +1 for b_in in range(1,max_data+1): for d_in in range(1,max_data+1): if int(b_in+d_in)==yakusu_sec: result_s = result_s +1 result = result + 2*result_f*result_s result_f = 0 result_s = 0 if k_data == 4: result = 1 print(result)