import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto T = readln.split.map!(to!long).array; auto D = readln.split.map!(to!long).array; auto acm = D.sum; auto TD = new Tuple!(long, int)[](N); foreach (i; 0..N) { TD[i] = tuple(T[i] * (acm-D[i]), i); } TD.sort!"a[0] > b[0]"(); TD.map!(a => (a[1]+1).to!string).join(" ").writeln; }