Moneymaking
Source: codechef
Difficulty: 183

Moneymaking
Chef has$X$nuggets
and$Y$star pieces
with him.
Each nugget sells for$5000$coins, and each star piece sells for$9800$coins.
How much money can Chef make by selling all of his items?
Input Format
The only line of input will contain two space-separated integers$X$and$Y$— the number of nuggets and star pieces Chef has.
Output Format
Output a single integer: the amount of money Chef can earn by selling all his items.
Constraints$0 \leq X, Y \leq 10$Sample 1:
Explanation:
There are two nuggets and three star pieces, so Chef will obtain$2\times 5000 + 3\times 9800 = 10000 + 29400 = 39400$from selling them all.
Sample 2:
Input
Output
4 0
20000
Explanation:
There are four nuggets and no star pieces, Chef will obtain$4\times 5000 = 20000$from selling them all.

Sample Input:
2 3

Sample Output:
39400

C++ solution:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define int long long

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int x, y; cin >> x >> y;

    cout << (x * 5000) + (y * 9800) << "\n";

    return 0;
}

Go solution:
package main
import "fmt"

func main(){
    var x, y int 
    fmt.Scan(&x, &y)
    fmt.Println((x*5000) + (y*9800))
}

Java solution:
import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = a*5000+b*9800;
        System.out.println(c);
    }
}

JavaScript solution:
// your code goes here
process.stdin.setEncoding("utf8");
process.stdin.on("data", function(input){
    const lines = input.trim().split("\n");
    const [x,y] = lines[0].split(" ").map(Number);
    
    console.log((x*5000) + (y*9800));
})

Python solution:
X, Y = map(int, input().split())
total_money = (X * 5000) + (Y * 9800)
print(total_money)

Ruby solution:
# Read input safely and calculate total money
begin
  input = gets
  if input.nil? || input.strip.empty?
    puts 0
  else
    x, y = input.strip.split.map(&:to_i)
    total = (x * 5000) + (y * 9800)
    puts total
  end
rescue
  puts 0
end