#C4659. Check Message Integrity

    ID: 48221 Type: Default 1000ms 256MiB

Check Message Integrity

Check Message Integrity

Given a message as a string and an integer checksum, check whether the sum of the ASCII values of the characters in the message equals the checksum. Formally, if the message has characters ( c_1, c_2, \dots, c_n ), you must verify if ( \sum_{i=1}^{n} \mathrm{ord}(c_i) = \text{checksum} ). The message will contain between 0 and 100 characters and the checksum will be an integer between 0 and 10,000. If the computed sum matches the provided checksum, output Valid; otherwise, output Invalid.

inputFormat

The input is given via standard input (stdin) and consists of two lines. The first line is a string representing the message (possibly empty). The second line is an integer representing the checksum.

outputFormat

Output a single line to standard output (stdout), which is either Valid if the sum of ASCII values of the message equals the checksum, or Invalid otherwise.## sample

hello
532
Valid