This page is still under construction.

Parts of this page are still being built. What you see may change.

Multiply

Time limit2sMemory limit128 MB

Summary
Multiply two non-negative integers given as decimal strings of up to 50,000 digits each and print the product without leading zeros.
Level

Medium6 of 10

Topics
Math, Implementation, Array, String matching
Solved
No attempts yet

Problem

Write a program that computes the product of two non-negative integers A and B. The integers are given in decimal notation and have N and M digits, respectively.

Input

The first line contains the lengths N and M, separated by a space. A is given on the second line and B on the third line. The numbers do not have leading zeros.

Output

Output the product of A and B without leading zeros.

Constraints

  • 1 ≤ N, M ≤ 50 000

Examples2

  1. Example 1

    Input
    3 4
    123
    4567
    
    Expected output
    561741
    
  2. Example 2

    Input
    3 1
    100
    0
    
    Expected output
    0