HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50408 - Molecules

Guest
• Review clarifications (3)

Section problems

• 50336 - Buying Carpets
• 50338 - Convert Into Decimal
• 50404 - Sum of Self Powers
• 50295 - Weighted Average
• 50343 - The number of Ending Zero...
• 50296 - Total Discount Rate
• 50289 - Monthly Allowance
• 50403 - Number of Chairs
• 50408 - Molecules
• 50481 - Car Parking
• 50413 - Valid Permutations
• 50412 - K numbers
• 50417 - Fun Fair
• 50433 - Sum of Cubes
• 50807 - Euro to Leke
• 50871 - Harmonic Mean
• 50521 - Pound to Grams

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Osman Ay.

Molecules

A molecule is a chemical structure that is made up of more than one atom. H2O is the molecule of water. It contains two hydrogen and one oxygen atoms. The weight of hydrogen is 1, and the weight of oxygen is 16. Thus the weight of water molecule is 2*1 + 16*1 = 18.

Question:
Write a program that calculates the mass of a molecule.

Input specification
The first line of the input contains an integer (n) that denotes the number of the atoms in the molecule where n i between 1 and 100. Each of the following n lines denotes an atom of the molecule with two integers. The first integer is the mass of the atom, and the second integer is the quantity of the atom.

Output specification
Show just one integer number: total weight of the molecule.

Sample Input I   
  2
  1 2
  16 1
Sample Output I   
  18


Для отправки решений необходимо выполнить вход.

www.contester.ru