<commit_before>#include <iostream>

using namespace std;

int main()
{
	int numEntries = 0;
	cin >> numEntries;
	cin.ignore();
	
	while (numEntries--)
	{
	}
	return 0;
}<commit_msg>Greedy oplossing voor B. Werkt voor testdata.<commit_after>#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int numEntries = 0;
	cin >> numEntries;
	cin.ignore();
	
	while (numEntries--)
	{
		int n, m;
		cin >> n >> m;
		int a, b;
		cin >> a >> b;
		vector<int> singles(n);
		for (int i = 0; i < n; i++) {
			cin >> singles[i];
		}
		int minutes = 0;
		int score = 0;
		for (int i = 0; i < n; i++) {
			if (minutes == m) {
				minutes = 0;
			}
			if (singles[i] + minutes < m) {
				minutes += singles[i];
			} else {
				int penaltyA = (singles[i] - (m - minutes)) * a;
				int penaltyB = (m - minutes) * b;
				if (penaltyA <= penaltyB) {
					score += penaltyA;
					minutes = 0;
				} else {
					score += penaltyB;
					minutes = singles[i];
				}
			}
		}
		if (minutes)
			score += (m - minutes) * b;
		cout << score << endl;
	}
	return 0;
}
{'fraction_non_alphanumeric': 0.17140151515151514, 'fraction_numerical': 0.00946969696969697, 'mean_word_length': 2.4207119741100325, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3963451', 'n_tokens_mistral': 500, 'n_tokens_neox': 414, 'n_words': 122}