static int CountSymbol(string word, char symbol)
foreach (char item in word)
public static void Main(string[] arg)
int[] price = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
string input = Console.ReadLine();
while (input != "Jail Time")
string[] goldSilverAndCosts = input.Split(' ').ToArray();
if (Convert.ToInt32(goldSilverAndCosts[1]) < 0)
Console.Write("The number can't be under 0. Enter the whole line again.");
profit += CountSymbol(goldSilverAndCosts[0], '%') * price[0];
profit += CountSymbol(goldSilverAndCosts[0], '$') * price[1];
profit -= Convert.ToInt32(goldSilverAndCosts[1]);
input = Console.ReadLine();
Console.WriteLine("Heists will continue. Total earnings: {0}.", profit);
Console.WriteLine("Have to find another job. Lost: {0}.", profit * (-1));