using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp189 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(); int a = int.Parse(str[0]); int b = int.Parse(str[1]); int c = int.Parse(str[2]); int d = int.Parse(str[3]); int e = int.Parse(str[4]); int kin = 0; int x = 0; int kosuu = (b - c) * a; for(int i = 1; i <= kosuu; i++) { if (i == 1) { kin += d; x = d; } else { if (i % 10 == 0) { if (e <= x) { if (x - e > 0) { kin += (x - e); x = x - e; } else { x = 0; } } else { kin += x; } } else { kin += x; } } } Console.WriteLine(kin); Console.ReadLine(); } } }