import std.stdio;
import std.algorithm;
import std.string;
import std.conv;

void main() {
	auto value =[6, 4, 3, 2];
	foreach (i; 0..4) {
		auto a = readln.split.map!(to!int);
		writeln(value[a[0]-1] * a[1] * 1000);
	}
}