# 模拟了一遍乘法运算 def strAdd(s1, s2): res, carry = '', 0 l1, l2 = len(s1)-1, len(s2)-1 while l1 >= 0 and l2 >= 0: a, b = s1[l1], s2[l2] r = int(a)+int(b)+carry carry = r//10 res = str(r % 10)+res l1 -= 1 l2 -= 1 def continueAdd(l, s, carry): nonlocal res while l >= 0: a = s[l] r = int(a)+carry carry = r//10 res = str(r % 10)+res l -= 1 if l1 >= 0: continueAdd(l1, s1, carry) elif l2 >= 0: continueAdd(l2, s2, carry) return res def findZero(s): t,i,n=s[-1],len(s)-1,0; while t=='0': i-=1; t=s[i]; n+=1; return s[:i+1],n def strMulti(n,s): f=[str(n*int(i)) for i in s[::-1] ] res=f[0]; i=-1; for s in f[1:]: res=strAdd(s,res[:i])+res[i:]; i-=1; return res; s1=input() s2=input(); s1,a=findZero(s1); s2,b=findZero(s2); zero=a+b; s1=int(s1); s2=int(s2); if (len(str(s1))>len(str(s2))): print(strMulti(s1,str(s2))+'0'*zero) else: print(strMulti(s2,str(s1))+'0'*zero)
# 大整数相乘 s1 = input() s2 = input() nums = [0]*(len(s1) + len(s2)) s3 = s1[::-1] s4 = s2[::-1] for i in range(len(s3)): for j in range(len(s4)): nums[i+j] += int(s3[i])*int(s4[j]) for i in range(len(nums)-1): nums[i+1] += nums[i] // 10 nums[i] = nums[i] % 10 res = '' for i in range(len(nums)-1, -1, -1): if i==len(nums)-1: if nums[i] == 0: continue else: res += str(nums[i]) else: res += str(nums[i]) ind = 0 while ind < len(nums): if res[ind] == '0': ind += 1 else: break print(res[ind:])