Integers Come In All Sizes in Python | HackerRank Solution

Hello coders, today we are going to solve Integers Come in All Sizes HackerRank Solution in Python.

Integers Come In All Sizes in Python


Integers in Python can be as big as the bytes in your machine’s memory. There is no limit in size as there is:231 – 1  (c++ int) or 263 – 1 (C++ long long int).

As we know, the result of ab grows really fast with increasing b.

Let’s do some calculations on very large integers.


Read four numbers, abc, and d, and print the result of ab + cd.

Input Format

Integers a, b, c, and d are given on four separate lines, respectively.


  • 1 <= a <= 1000
  • 1 <= b <= 1000
  • 1 <= c <= 1000
  • 1 <= d <= 1000

Output Format

Print the result of ab + cd on one line.

Sample Input


Sample Output


Note: This result is bigger than 263 – 1. Hence, it won’t fit in the long long int of C++ or a 64-bit integer.

Solution – Integers Come In All Sizes In Python

# Enter your code here. Read input from STDIN. Print output to STDOUT
a = int(input())
b = int(input())
c = int(input())
d = int(input())


Disclaimer: The above Problem (Integers Come In All Sizes) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

Leave a Comment

Your email address will not be published.