// Cheese-Cracker: cheese-cracker.github.io

void theCode(){
    int n;
    n = scan!int;
    ll[] miner;
    ll[] diam;
    ll x, y;
    for(int i = 0; i < 2*n; ++i) {
        x = scan; y = scan;
        if(x == 0){
            miner ~= abs(y);
        }else{
            diam ~= abs(x);
        }
    }
    miner.sort;
    diam.sort;
    double res = 0;
    for(int i = 0; i < n; ++i){
        double curres = miner[i]*miner[i] + diam[i]*diam[i];
        curres = sqrt(curres);
        res += curres;
    }
    writefln("%.12f", res);
}

void main(){
    long tests = 1;
    tests = scan;        // Toggle!
    while(tests--) theCode();
}

/*********  That's All Folks!  *********/
import std.stdio, std.random, std.functional, std.container, std.algorithm;
import std.numeric, std.range, std.typecons, std.string, std.math, std.conv;
string[] tk; T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }
alias ll = long, tup = Tuple!(long, "x",  long, "y");

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new double[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;

		long[] a, b;
		foreach (i; 0..n*2)
		{
			auto x = RD;
			auto y = RD;
			if (x == 0)
				a ~= y.abs;
			else
				b ~= x.abs;
		}
		a.sort();
		b.sort();

		ans[ti] = 0.0;
		foreach (i; 0..n)
		{
			ans[ti] += sqrt(cast(double)a[i]^^2 + b[i]^^2);
		}
	}

	foreach (e; ans)
		writefln("%.15f", e);
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new double[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;

		int[] a, b;
		foreach (i; 0..n*2)
		{
			auto x = RD!int;
			auto y = RD!int;
			if (x == 0)
				a ~= y.abs;
			else
				b ~= x.abs;
		}
		a.sort();
		b.sort();

		ans[ti] = 0.0;
		foreach (i; 0..n)
		{
			ans[ti] += sqrt(cast(double)a[i]^^2 + b[i]^^2);
		}
	}

	foreach (e; ans)
		writefln("%.15f", e);
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new double[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;

		int[] a, b;
		foreach (i; 0..n*2)
		{
			auto x = RD!int;
			auto y = RD!int;
			if (x == 0)
				a ~= y.abs;
			else
				b ~= x.abs;
		}
		a.sort();
		b.sort();

		ans[ti] = 0.0;
		foreach (i; 0..n)
		{
			ans[ti] += sqrt(cast(double)a[i]^^2 + b[i]^^2);
		}
	}

	foreach (e; ans)
		writefln(FMT_F, e);
	stdout.flush;
	debug readln;
}


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

void main ()
{
	auto tests = readln.strip.to !(int);
multitest_loop:
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		auto m = a.maxElement;
		foreach (i; 0..n)
		{
			if (a[i] == m && ((i > 0 && a[i - 1] < a[i]) ||
			    (i + 1 < n && a[i + 1] < a[i])))
			{
				writeln (i + 1);
				continue multitest_loop;
			}
		}
		writeln (-1);
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new long[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto a = RDA;

		long x;
		foreach (i; 0..n)
		{
			x.chmax(a[i]);
		}

		ans[ti] = -1;
		foreach (i; 0..n)
		{
			if (a[i] != x) continue;
			if (i != 0)
			{
				if (a[i] > a[i-1])
				{
					ans[ti] = i+1;
					break;
				}
			}
			if (i != n-1)
			{
				if (a[i] > a[i+1])
				{
					ans[ti] = i+1;
					break;
				}
			}
		}
	}

	foreach (e; ans)
		writeln(e);
	stdout.flush;
	debug readln;
}

// Cheese-Cracker: cheese-cracker.github.io

void play(){
    int n;
    n = rd!int;
    ll[] arr = rdarr;
    ll maxx = arr.maxElement;
    ll maxi = -1;
    foreach(i; 0..n){
        if(arr[i] == maxx){
            if(i > 0 && arr[i-1] < maxx){
                maxi = i + 1;
                break;
            }else if(i < n - 1 && arr[i+1] < maxx){
                maxi = i + 1;
                break;
            }
        }
    }
    writeln(maxi);
}

int main(){
    long t = 1;
    t = rd;        // Toggle!
    while(t--) play();  // Let's play!
    stdout.flush;
    return 0;
}

/**********It's A Me Mario!**********/
import std.stdio, std.conv, std.functional, std.string, std.algorithm;
import std.container, std.range, std.typecons, std.numeric, std.math, std.random;
static string[] inp;
T rd(T = long)(){while(!inp.length) inp = readln.chomp.split; string a = inp[0]; inp.popFront; return a.to!T;}
T[] rdarr(T = long)(){ auto r = readln.chomp.split.to!(T[]); return r; }
void show(A...)(A a) { debug{ a.each!(w => write(w, "| ")); writeln; } }
alias ll = long;
alias rbt = redBlackTree;
alias tup = Tuple!(long, long);
T max(T = long)(T a, T b){ return (a > b) ? a : b; }
T min(T = long)(T a, T b){ return (a < b) ? a : b; }


import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

immutable int MAX_N = 1_000_006;

void main ()
{
	int n;
	while (readf (" %s ", &n) > 0)
	{
		auto b = new bool [MAX_N];
		foreach (x; readln.split.map !(to !(int)))
		{
			b[x] = true;
		}

		auto f = new int [MAX_N];
		foreach (i; 0..MAX_N)
		{
			f[i] = b[i];
		}

		int res = 0;
		for (int x = 1; x < MAX_N; x++)
		{
			if (!b[x])
			{
				continue;
			}
			for (int y = x * 2; y < MAX_N; y += x)
			{
				if (!b[y])
				{
					continue;
				}
				f[y] = max (f[y], f[x] + 1);
			}
			res = max (res, f[x]);
		}
		writeln (res);
	}
}

import std.algorithm, std.conv, std.stdio, std.range;
immutable int MAX_N = 1_000_006;
void main ()
{
    int n;
    while (readf (" %s ", &n) > 0)
    {
        auto f = new int [MAX_N];
        foreach (x; readln.split.map !(to !(int)))
            f[x] = 1;
        for (int x = 1; x < MAX_N; x++) if (f[x])
            for (int y = x * 2; y < MAX_N; y += x) if (f[y])
                f[y] = max (f[y], f[x] + 1);
        f.minPos !(q{a > b}).front.writeln;
    }
}

import std.algorithm, std.conv, std.stdio, std.range;
immutable int MAX_N = 1_000_006;
void main ()
{
	int n;
	readf (" %s ", &n);
	auto f = new int [MAX_N];
	foreach (x; readln.split.map!(to!int))
		for (int y = x * 2; y < MAX_N; y += x)
			f[y] = max (f[y], f[x] + 1);
	f.minPos!q{a > b}.front.writeln;
}


void main() { runSolver(); }

void problem() {
  auto QN = scan!int;

  auto solve() {
    auto subSolve() {
      auto P = 3.iota.map!(_ => Point(scan!long, scan!long)).array;

      auto maxY = P.map!"a.y".maxElement;
      auto mys = P.filter!(a => a.y == maxY).array;

      if (mys.length == 2) {
        return (mys[0].x - mys[1].x).abs;
      }

      return 0;
    }

    foreach(i; 0..QN) {
      subSolve().writeln;
    }
  }

  outputForAtCoder(&solve);
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric, std.traits, std.functional, std.bigint, std.datetime.stopwatch, core.time, core.bitop;
T[][] combinations(T)(T[] s, in long m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(long n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
Point invert(Point p) { return Point(p.y, p.x); }
long[] divisors(long n) { long[] ret; for (long i = 1; i * i <= n; i++) { if (n % i == 0) { ret ~= i; if (i * i != n) ret ~= n / i; } } return ret.sort.array; }
bool chmin(T)(ref T a, T b) { if (b < a) { a = b; return true; } else return false; }
bool chmax(T)(ref T a, T b) { if (b > a) { a = b; return true; } else return false; }
string charSort(alias S = "a < b")(string s) { return (cast(char[])((cast(byte[])s).sort!S.array)).to!string; }
ulong comb(ulong a, ulong b) { if (b == 0) {return 1;}else{return comb(a - 1, b - 1) * a / b;}}
T[] compress(T)(T[] arr, T origin = T.init) { T[T] indecies; arr.dup.sort.uniq.enumerate(origin).each!((i, t) => indecies[t] = i); return arr.map!(t => indecies[t]).array; }
string toAnswerString(R)(R r) { return r.map!"a.to!string".joiner(" ").array.to!string; }
struct ModInt(uint MD) if (MD < int.max) {ulong v;this(string v) {this(v.to!long);}this(int v) {this(long(v));}this(long v) {this.v = (v%MD+MD)%MD;}void opAssign(long t) {v = (t%MD+MD)%MD;}static auto normS(ulong x) {return (x<MD)?x:x-MD;}static auto make(ulong x) {ModInt m; m.v = x; return m;}auto opBinary(string op:"+")(ModInt r) const {return make(normS(v+r.v));}auto opBinary(string op:"-")(ModInt r) const {return make(normS(v+MD-r.v));}auto opBinary(string op:"*")(ModInt r) const {return make((ulong(v)*r.v%MD).to!ulong);}auto opBinary(string op:"^^", T)(T r) const {long x=v;long y=1;while(r){if(r%2==1)y=(y*x)%MD;x=x^^2%MD;r/=2;} return make(y);}auto opBinary(string op:"/")(ModInt r) const {return this*memoize!inv(r);}static ModInt inv(ModInt x) {return x^^(MD-2);}string toString() const {return v.to!string;}auto opOpAssign(string op)(ModInt r) {return mixin ("this=this"~op~"r");}}
alias MInt1 = ModInt!(10^^9 + 7);
alias MInt9 = ModInt!(998_244_353);
void outputForAtCoder(T)(T delegate() fn) {
  static if (is(T == float) || is(T == double) || is(T == real)) "%.16f".writefln(fn());
  else static if (is(T == void)) fn();
  else static if (is(T == string)) fn().writeln;
  else static if (isInputRange!T) {
    static if (!is(string == ElementType!T) && isInputRange!(ElementType!T)) foreach(r; fn()) r.toAnswerString.writeln;
    else foreach(r; fn()) r.writeln;
  }
  else fn().writeln;
}
void runSolver() {
  enum BORDER = "==================================";
  debug { BORDER.writeln; while(!stdin.eof) { "<<< Process time: %s >>>".writefln(benchmark!problem(1)); BORDER.writeln; } }
  else problem();
}
enum YESNO = [true: "Yes", false: "No"];

// -----------------------------------------------

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }
double euDist(T)(T[] a, T[] b) { auto c = a.dup; c[] -= b[]; c[] *= c[]; return sqrt(cast(double)c.sum); }
double[] rotate(double[] vec, double rad) { return [cos(rad)*vec[0] - sin(rad)*vec[1], sin(rad)*vec[0] + cos(rad)*vec[1]]; }
double norm(double[] vec) { return sqrt(reduce!((a,b)=>a+b*b)(0.0, vec)); }
double dotProd(double[] a, double[] b) { auto r = a.dup; r[] *= b[]; return r.sum; }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new double[](t);
	foreach (ti; 0..t)
	{
		auto x = new long[](3);
		auto y = new long[](3);
		foreach (i; 0..3)
		{
			x[i] = RD;
			y[i] = RD;
		}

		auto index = y.MAKE_IDX;
		if (y[index[1]] == y[index[2]])
			ans[ti] = abs(x[index[1]] - x[index[2]]);
		else
			ans[ti] = 0.0;
	}

	foreach (e; ans)
		writefln(FMT_F, e);
	stdout.flush;
	debug readln;
}

import std.stdio;
import std.conv;
import std.string;
import std.math;

auto line_to_array(ref File input)
{
    import std.algorithm.sorting;
    import std.conv;
    import std.string;
    return input.readln.chomp.split;
}

auto line_to_int(ref File input)
{
    import std.string;
    import std.conv;
    return input.readln.chomp.to!int;
}

void solution(ref File input, ref File output)
{
    auto fd = input.getFP;

    double answer = 0;
    long[3] x, y;

    for (int i = 0; i < 3; i++) input.readf!"%d %d\n"(x[i], y[i]);

    for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
    for (int c = 0; c < 3; c++)
        if (i != j && j != c && i != c && y[i] == y[j] && y[i] > y[c])
        {
            answer += sqrt(cast(double) (pow(y[i] - y[j], 2) + pow(x[i] - x[j], 2)));
            break;
        }
    output.writefln("%f", answer / 2);
}

void loop(ref File input, ref File output)
{
    auto t = input.readln.chomp.to!int;
    while (t-- > 0) solution(input, output);
}

int main()
{
    File input, output;
    debug(1)
    {
        input = File("input.txt", "r");
        output = File("output.txt", "w");
    } else
    {
        input = stdin;
        output = stdout;
    }
    loop(input, output);
    return 0;
}

import std.stdio;
import std.conv;
import std.string;
import std.math;

auto line_to_array(ref File input)
{
    import std.algorithm.sorting;
    import std.conv;
    import std.string;
    return input.readln.chomp.split;
}

auto line_to_int(ref File input)
{
    import std.string;
    import std.conv;
    return input.readln.chomp.to!int;
}

void solution(ref File input, ref File output)
{
    auto fd = input.getFP;

    double answer = 0;
    long[3] x, y;

    for (int i = 0; i < 3; i++) input.readf!"%d %d\n"(x[i], y[i]);

    for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
    for (int c = 0; c < 3; c++)
        if (i != j && j != c && i != c && y[i] == y[j] && y[i] > y[c])
        {
            answer += sqrt(cast(double) (pow(y[i] - y[j], 2) + pow(x[i] - x[j], 2)));
            break;
        }
    output.writeln(answer / 2);
}

void loop(ref File input, ref File output)
{
    auto t = input.readln.chomp.to!int;
    while (t-- > 0) solution(input, output);
}

int main()
{
    File input, output;
    debug(1)
    {
        input = File("input.txt", "r");
        output = File("output.txt", "w");
    } else
    {
        input = stdin;
        output = stdout;
    }
    loop(input, output);
    return 0;
}

import std.stdio;
import std.conv;
import std.string;
import std.math;

auto line_to_array(ref File input)
{
    import std.algorithm.sorting;
    import std.conv;
    import std.string;
    return input.readln.chomp.split;
}

auto line_to_int(ref File input)
{
    import std.string;
    import std.conv;
    return input.readln.chomp.to!int;
}

void solution(ref File input, ref File output)
{
    auto fd = input.getFP;

    float answer = 0;
    int[3] x, y;

    core.stdc.stdio.fscanf(fd, "%d %d\n", &x[0], &y[0]);
    core.stdc.stdio.fscanf(fd, "%d %d\n", &x[1], &y[1]);
    core.stdc.stdio.fscanf(fd, "%d %d\n", &x[2], &y[2]);

    for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
    for (int c = 0; c < 3; c++)
        if (i != j && j != c && i != c && y[i] == y[j] && y[i] > y[c])
        {
            //output.writefln("i: %d x: %d y: %d", i, x[i], y[i]);
            //output.writefln("j: %d x: %d y: %d", j, x[j], y[j]);
            //output.writefln("c: %d x: %d y: %d", c, x[c], y[c]);
            answer += sqrt(cast(float) (pow(y[i] - y[j], 2) + pow(x[i] - x[j], 2)));
            //answer += cast(float) (pow(y[i] - y[j], 2) + pow(x[i] - x[j], 2));
            break;
        }
    output.writeln(answer / 2);
}

void loop(ref File input, ref File output)
{
    auto t = input.readln.chomp.to!int;
    while (t-- > 0) solution(input, output);
}

int main()
{
    File input, output;
    debug(1)
    {
        input = File("input.txt", "r");
        output = File("output.txt", "w");
    } else
    {
        input = stdin;
        output = stdout;
    }
    loop(input, output);
    return 0;
}

void main() { runSolver(); }

void problem() {
  auto QN = scan!int;

  auto solve() {
    auto subSolve() {
      auto P = 3.iota.map!(_ => Point(scan!long, scan!long)).array;

      auto maxY = P.map!"a.y".maxElement;
      auto mys = P.filter!(a => a.y == maxY).array;

      if (mys.length == 2) {
        return ((mys[0].x - mys[1].x).to!real.pow(2) + (mys[0].y - mys[1].y).to!real.pow(2)).sqrt;
      }

      return 0.0;
    }

    foreach(i; 0..QN) {
      subSolve().writeln;
    }
  }

  outputForAtCoder(&solve);
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric, std.traits, std.functional, std.bigint, std.datetime.stopwatch, core.time, core.bitop;
T[][] combinations(T)(T[] s, in long m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(long n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
Point invert(Point p) { return Point(p.y, p.x); }
long[] divisors(long n) { long[] ret; for (long i = 1; i * i <= n; i++) { if (n % i == 0) { ret ~= i; if (i * i != n) ret ~= n / i; } } return ret.sort.array; }
bool chmin(T)(ref T a, T b) { if (b < a) { a = b; return true; } else return false; }
bool chmax(T)(ref T a, T b) { if (b > a) { a = b; return true; } else return false; }
string charSort(alias S = "a < b")(string s) { return (cast(char[])((cast(byte[])s).sort!S.array)).to!string; }
ulong comb(ulong a, ulong b) { if (b == 0) {return 1;}else{return comb(a - 1, b - 1) * a / b;}}
T[] compress(T)(T[] arr, T origin = T.init) { T[T] indecies; arr.dup.sort.uniq.enumerate(origin).each!((i, t) => indecies[t] = i); return arr.map!(t => indecies[t]).array; }
string toAnswerString(R)(R r) { return r.map!"a.to!string".joiner(" ").array.to!string; }
struct ModInt(uint MD) if (MD < int.max) {ulong v;this(string v) {this(v.to!long);}this(int v) {this(long(v));}this(long v) {this.v = (v%MD+MD)%MD;}void opAssign(long t) {v = (t%MD+MD)%MD;}static auto normS(ulong x) {return (x<MD)?x:x-MD;}static auto make(ulong x) {ModInt m; m.v = x; return m;}auto opBinary(string op:"+")(ModInt r) const {return make(normS(v+r.v));}auto opBinary(string op:"-")(ModInt r) const {return make(normS(v+MD-r.v));}auto opBinary(string op:"*")(ModInt r) const {return make((ulong(v)*r.v%MD).to!ulong);}auto opBinary(string op:"^^", T)(T r) const {long x=v;long y=1;while(r){if(r%2==1)y=(y*x)%MD;x=x^^2%MD;r/=2;} return make(y);}auto opBinary(string op:"/")(ModInt r) const {return this*memoize!inv(r);}static ModInt inv(ModInt x) {return x^^(MD-2);}string toString() const {return v.to!string;}auto opOpAssign(string op)(ModInt r) {return mixin ("this=this"~op~"r");}}
alias MInt1 = ModInt!(10^^9 + 7);
alias MInt9 = ModInt!(998_244_353);
void outputForAtCoder(T)(T delegate() fn) {
  static if (is(T == float) || is(T == double) || is(T == real)) "%.16f".writefln(fn());
  else static if (is(T == void)) fn();
  else static if (is(T == string)) fn().writeln;
  else static if (isInputRange!T) {
    static if (!is(string == ElementType!T) && isInputRange!(ElementType!T)) foreach(r; fn()) r.toAnswerString.writeln;
    else foreach(r; fn()) r.writeln;
  }
  else fn().writeln;
}
void runSolver() {
  enum BORDER = "==================================";
  debug { BORDER.writeln; while(!stdin.eof) { "<<< Process time: %s >>>".writefln(benchmark!problem(1)); BORDER.writeln; } }
  else problem();
}
enum YESNO = [true: "Yes", false: "No"];

// -----------------------------------------------


import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

void main() {
    int n;
    scan(n);
    auto s = readln.chomp;

    foreach (i ; 0 .. n - 1) {
        if (s[i] != s[i+1]) {
            writeln("YES");
            writeln(s[i .. i+2]);
            return;
        }
    }

    writeln("NO");
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

//ahmat
import core.stdc.stdio:printf,scanf;
import std.stdio;
import std.string;
import std.container;
import std.array;
import std.range;
import std.algorithm;
import std.math;
import std.numeric;
import std.conv;
import std.bitmanip;
import core.bitop;
int sz(Range)(in Range r){return cast(int)r.length;}
alias rbt=RedBlackTree!int;

void main(){
	int n;
	scanf("%d",&n);
	readln;
	string s=readln.strip;
	bool found=false;
	int i=0;
	for(;i<n-1;i++){
		if(s[i]!=s[i+1]){
			writeln("YES");
			writeln(s[i..i+2]);
			found=true;
			break;
		}
	}
	if(!found) writeln("NO");
}

//ahmat
import core.stdc.stdio:printf,scanf;
import std.stdio;
import std.string;
import std.container;
import std.array;
import std.range;
import std.algorithm;
import std.math;
import std.numeric;
import std.conv;
import std.bitmanip;
import core.bitop;
int sz(Range)(in Range r){return cast(int)r.length;}
alias rbt=RedBlackTree!int;

void main(){
	int n;
	scanf("%d",&n);
	readln;
	string s=readln.strip;
	bool found=false;
	int i=0;
	if(s.length>1){
		for(;i<n-1;i++){
			if(s[i]!=s[i+1]){
				found=true;
				break;
			}
		}
	}
	if(found){
		writeln("YES");
		writeln(s[i..i+2]);
	}else writeln("NO");
}

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.string;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;
    auto cnt = new int[](26);

    bool ok(int l, int r) {
        cnt[] = 0;
        foreach (i; l..r+1) cnt[S[i]-'a'] += 1;
        return cnt.reduce!max * 2 <= r - l + 1;
    }

    foreach (i; 0..N) {
        foreach (j; i..N) {
            if (ok(i, j)) {
                writeln("YES");
                writeln(S[i..j+1]);
                return;
            }
        }
    }

    writeln("NO");
}

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.string;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;
    auto cnt = new int[](26);

    bool ok(int l, int r) {
        cnt[] = 0;
        foreach (i; l..r+1) cnt[S[i]-1] += 1;
        return cnt.reduce!max * 2 <= r - l + 1;
    }

    foreach (i; 0..N) {
        foreach (j; i..N) {
            if (ok(i, j)) {
                writeln("YES");
                writeln(S[i..j+1]);
                return;
            }
        }
    }

    writeln("NO");
}


import std.stdio;
import std.algorithm.comparison;
void main()
{
  int n;
  scanf("%d", &n);

  int[5000] a;
  foreach (i; 0..n) {
    scanf("%d", &a[i]);
  }

  int m = 0;
  foreach (i; 0..n) {
    int t = 0;
    foreach (j; i..n) {
      t += a[j];
      if (t > 100 * (j - i + 1)) {
        m = max(m, j - i + 1);
      }
    }
  }

  printf("%d\n", m);
}

import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.datetime.stopwatch;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto arr = readln.chomp.split.map!(to!int).array;

    int mxlen = 0;
    foreach (le; 0 .. n) {
        int sm = 0, len = 0;
        foreach (r; le .. n) {
            sm += arr[r];
            len += 1;

            if (sm > 100 * len) { mxlen = max(mxlen, len); }
        }
    }

    mxlen.writeln;
}

import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.datetime.stopwatch;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto arr = readln.chomp.split.map!(to!int).array;

    int mxlen = 0;
    foreach (le; 0 .. n) {
        int sm = 0, len = 0;
        foreach (r; le .. n) {
            sm += arr[r];
            len += 1;

            if (sm >= 100 * len) { mxlen = max(mxlen, len); }
        }
    }

    if (mxlen == n) { mxlen -= 1; }

    mxlen.writeln;
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(    const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

immutable long MO = 10^^9 + 7;
immutable LIM = 2 * 10^^5 + 5;

long[] inv, fac, facInv;

void prepare() {
	inv = new long[LIM];
	inv[1] = 1;
	foreach (i; 2 .. LIM) {
		inv[i] = MO - MO / i * inv[cast(size_t)(MO % i)] % MO;
	}
	fac = new long[LIM];
	facInv = new long[LIM];
	fac[0] = 1;
	facInv[0] = 1;
	foreach (i; 1 .. LIM) {
		fac[i] = fac[i - 1] * i % MO;
		facInv[i] = facInv[i - 1] * inv[i] % MO;
	}
}

long binom(int n, int k) {
	if (!(0 <= k && k <= n)) {
		return 0;
	}
	return fac[n] * facInv[k] % MO * facInv[n - k] % MO;
}

int N, K;
string S;

void main(string[] args) {
	prepare;

	try {
	for (; ; ) {
		N = readInt;
		K = readInt;
		S = readToken;

debug{
long brt;
foreach(h;0..1<<(N-1)){
 int cnt;
 foreach(i;0..N-1)if(h&1<<i)++cnt;
 if(cnt!=K)continue;
 long x;
 foreach(i;0..N){
  x=(x*10+S[i]-'0')%MO;
  // writeln(h," ",x);
  if((h&1<<i)||i==N-1){(brt+=x)%=MO;x=0;}
 }
}
writeln("brt = ",brt);
}

		long ans;
		long sum = 0;
		long ten = 1;
		foreach_reverse (i; 0 .. N) {
debug{
// writeln("sum = ",sum,", binom(i, K) * ten = ",binom(i, K) * ten);
}
			(ans += ((sum + binom(i, K) * ten) % MO) * (S[i] - '0')) %= MO;
			(sum += binom(i - 1, K - 1) * ten) %= MO;
			(ten *= 10) %= MO;
		}
		ans = (ans % MO + MO) % MO;
		writeln(ans);

	}
	} catch (EOFException) {}
}

import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

immutable int MOD  = 1_000_000_007;
immutable int BASE =            10;

int powmod (int a, int p, int m)
{
	int res = 1;
	while (p)
	{
		if (p & 1)
		{
			res = (cast (long) res * a) % m;
		}
		a = (cast (long) a * a) % m;
		p >>= 1;
	}
	return res;
}

int inv (int a)
{
	return powmod (a, MOD - 2, MOD);
}

void main ()
{
	int n, k;
	while (readf (" %s %s ", &n, &k) > 0)
	{
		auto a = readln ().strip ().map !(q{a - '0'}) ().array ();
		debug {writeln (a);}

		long [] p = [1];
		foreach (i; 0..n)
		{
			p ~= (p[$ - 1] * BASE) % MOD;
		}
		debug {writeln (p);}

		long [] c = [1];
		foreach (i; k..n - 1)
		{
			c ~= (((c[$ - 1] * i) % MOD) * inv (i - k + 1)) % MOD;
		}
		reverse (c);
		debug {writeln (c);}

		long s = 0;
		foreach (i; 0..c.length)
		{
			s = (s + c[i] * p[i]) % MOD;
		}
		debug {writeln (s);}

		long res = 0;
		foreach (i; 0..n)
		{
			res = (res + s * a[i]) % MOD;
			int j = n - i - 1;
			if (0 < j && j < c.length)
			{
				s = (s - c[j] * p[j]) % MOD;
				s = (s + c[j] * p[j - 1]) % MOD;
				c[j - 1] = (c[j - 1] + c[j]) % MOD;
				j--;
				s = (s + MOD) % MOD;
				debug {writeln (c, ' ', s);}
			}
		}
		writeln (res);
	}
}


import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

// a^-1 (mod m)
long modInv(long a, long m)
in {
  assert(m > 0, "modInv: m > 0 must hold");
}
do {
  long b = m, x = 1, y = 0, t;
  for (; ; ) {
    t = a / b;
    a -= t * b;
    if (a == 0) {
      assert(b == 1 || b == -1, "modInv: gcd(a, m) != 1");
      if (b == -1) {
        y = -y;
      }
      return (y < 0) ? (y + m) : y;
    }
    x -= t * y;
    t = b / a;
    b -= t * a;
    if (b == 0) {
      assert(a == 1 || a == -1, "modInv: gcd(a, m) != 1");
      if (a == -1) {
        x = -x;
      }
      return (x < 0) ? (x + m) : x;
    }
    y -= t * x;
  }
}

enum long MO = 998244353;

int N, M;
int[] A;
long[] W;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      M = readInt();
      A = new int[N];
      foreach (i; 0 .. N) {
        A[i] = readInt();
      }
      W = new long[N];
      foreach (i; 0 .. N) {
        W[i] = readLong();
      }

      long R, S;
      foreach (i; 0 .. N) {
        if (A[i]) {
          R += W[i];
        }
        S += W[i];
      }

      auto invs = new long[2 * M + 1];
      foreach (x; -M .. +M + 1) {
        if (S + x > 0) {
          invs[M + x] = modInv(S + x, MO);
        }
      }

      auto dp = new long[][](M + 1, M + 1);
      dp[0][0] = 1;
      foreach (j; 0 .. M) {
        foreach (x; 0 .. j + 1) {
          if (S + x + (j - x) > 0) {
            const prob = ((R + x) * invs[M + x - (j - x)]) % MO;
            (dp[j + 1][x + 0] += dp[j][x] * (1 - prob)) %= MO;
            (dp[j + 1][x + 1] += dp[j][x] * prob) %= MO;
          }
        }
      }
      debug {
        writeln("dp = ", dp);
      }

      long eP, eN;
      foreach (x; 0 .. M + 1) {
        (eP += dp[M][x] * (R + x)) %= MO;
        (eN += dp[M][x] * (S - R - (M - x))) %= MO;
      }
      foreach (i; 0 .. N) {
        long ans;
        if (A[i]) {
          ans = (((eP * W[i]) % MO) * modInv(R, MO)) % MO;
        } else {
          ans = (((eN * W[i]) % MO) * modInv(S - R, MO)) % MO;
        }
        ans = (ans % MO + MO) % MO;
        writeln(ans);
      }
    }
  } catch (EOFException e) {
  }
}


import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm
    , std.range
    , std.container;

void main() {
    uint n, k;
    readf("%s %s\n", &n, &k);

    auto fence = new uint[n];
    auto sum_arr = new uint[n+1];

    uint f_sum;

    foreach(i, ref f; fence) {
        //uint f;
        readf("%s ", &f);
        sum_arr[i+1] = f_sum + f;
        f_sum += f;
    }

    uint min = sum_arr[k] - sum_arr[0], min_idx = 1;

    for(uint j = k; j < n+1; ++j) {
        if(sum_arr[j] - sum_arr[j - k] < min) {
            min = sum_arr[j] - sum_arr[j - k];
            min_idx = j - k + 1;
        }
    }

    min_idx.writeln;
    //foreach()
}

alias id(alias token) = token;

alias var(alias elem) = std.traits.Unqual!(typeof(elem));

auto mut(T)(auto ref T in_val) {
    std.traits.Unqual!(T) rv = in_val;
    return rv;
}

auto imut(T)(auto ref T in_val) {
    immutable immrv = in_val;
    return immrv;
}

import std.stdio, std.string, std.algorithm;
import std.conv, std.array;
import std.container;
import std.typecons;

void main() {
    int n, k; readf("%d %d\n", &n, &k);
    int[] xs = stdin.readln.chomp.split(" ").map!(to!int).array;
    int[] ss = new int[xs.length+1];
    ss[0] = 0;
    for (int i = 0; i < xs.length; i++) {
        ss[i+1] = ss[i] + xs[i];
    }
    int ans = int.max;
    int index = -1;
    for (int i = 0; i <= xs.length - k; i++) {
        if (ans > ss[i+k] - ss[i]) {
            ans = ss[i+k] - ss[i];
            index = i + 1;
        }
    }
    index.writeln;
}

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, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto H = readln.split.map!(to!int).array;

    auto acm = new int[](N+1);
    foreach (i; 0..N) {
        acm[i+1] = acm[i] + H[i];
    }

    int minv = int.max;
    int mini = -1;

    foreach (i; 0..N-K+1) {
        auto a = acm[i+K] - acm[i];
        if (a < minv) {
            minv = a;
            mini = i+1;
        }
    }
    mini.writeln;
}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm
    , std.range
    , std.container;

void main() {
    uint n, k;
    readf("%s %s\n", &n, &k);

    //auto fence = new uint[n];
    auto sum_arr = new uint[n+1];

    uint f_sum;

    foreach(i; 0..n) {
        uint f;
        readf("%s ", &f);
        sum_arr[i+1] = f_sum + f;
        f_sum += f;
    }

    uint min = sum_arr[k] - sum_arr[0], min_idx = 1;

    for(uint j = k; j < n+1; ++j) {
        if(sum_arr[j] - sum_arr[j - k] < min) {
            min = sum_arr[j] - sum_arr[j - k];
            min_idx = j - k + 1;
        }
    }

    min_idx.writeln;
    //foreach()
}

alias id(alias token) = token;

alias var(alias elem) = std.traits.Unqual!(typeof(elem));

auto mut(T)(auto ref T in_val) {
    std.traits.Unqual!(T) rv = in_val;
    return rv;
}

auto imut(T)(auto ref T in_val) {
    immutable immrv = in_val;
    return immrv;
}

//ahmat
import core.stdc.stdio:scanf,printf,puts;
import core.bitop;
import std.stdio;
import std.string;
import std.algorithm;
import std.functional;
import std.array;
import std.container;
import std.conv;
import std.container;
import std.typecons;
import std.math;
import std.numeric;
pragma(inline,true);

void main(){
    int n,k;
    readf!"%d %d"(n,k);
    readln;
    auto a=readln.splitter
                 .map!(to!int)
                 .cumulativeFold!"a+b"
                 .array;
    int m=int.max,r;
    foreach(i;k-1..n){
        int cur=a[i];
        if(i>=k) cur-=a[i-k];
        if(cur<m){
            m=cur;
            r=i;
        }
    }
    writeln(r-k+2);
}

//ahmat
import core.stdc.stdio:scanf,printf,puts;
import core.bitop;
import std.stdio;
import std.string;
import std.algorithm;
import std.functional;
import std.array;
import std.container;
import std.conv;
import std.container;
import std.typecons;
import std.math;
import std.numeric;
pragma(inline,true);

void main(){
    int n,k;
    readf!"%d %d"(n,k);
    readln;
    auto a=readln.splitter
                 .map!(to!int)
                 .array;
    foreach(i;1..n)
        a[i]+=a[i-1];
    int m=int.max,r;
    foreach(i;k-1..n){
        int cur=a[i];
        if(i>=k) cur-=a[i-k];
        if(cur<m){
            m=cur;
            r=i;
        }
    }
    writeln(r-k+2);
}

import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable int mod = 10^^9 + 7;

void main()
{
    int n, k;
    readVars(n, k);
    auto h = readln.split.to!(int[]);

    int j;
    int maxsum = h[0 .. k].sum;
    int v = maxsum;

    foreach(r ; k .. n){
        v += h[r] - h[r - k];

        if (maxsum > v) {
            maxsum = v;
            j = r - k + 1;
        }
    }

    writeln(j + 1);
}

void readVars(T...)(auto ref T args)
{
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        writeln(line);
        throw new Exception("args num < input num");
    }
}

import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable int mod = 10^^9 + 7;

void main()
{
    int n, k;
    readVars(n, k);
    auto h = readln.split.to!(int[]);
    auto hps = new int[](n + 1);

    foreach(i ; 0 .. n) hps[i + 1] += hps[i] + h[i];

    debug {
        writeln(hps);
    }

    int minsum = mod, j;

    foreach(i ; 0 .. n - k + 1) {
        if (minsum > hps[i + k] - hps[i]) {
            minsum = hps[i + k] - hps[i];
            j = i;
        }
    }

    writeln(j + 1);
}

void readVars(T...)(auto ref T args)
{
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        writeln(line);
        throw new Exception("args num < input num");
    }
}

import std.stdio, std.string, std.algorithm;
import std.conv, std.array;
import std.container;
import std.typecons;

void main() {
    int n, k; readf("%d %d\n", &n, &k);
    int[] xs = stdin.readln.chomp.split(" ").map!(to!int).array;
    int[] ss = new int[xs.length+1];
    ss[0] = 0;
    for (int i = 0; i < xs.length - 1; i++) {
        ss[i+1] = ss[i] + xs[i];
    }
    int ans = int.max;
    int index = -1;
    for (int i = 0; i < xs.length - k; i++) {
        if (ans > ss[i+k] - ss[i]) {
            ans = ss[i+k] - ss[i];
            index = i + 1;
        }
    }
    index.writeln;
}

import std.stdio, std.string, std.algorithm;
import std.conv, std.array;
import std.container;
import std.typecons;

void main() {
    int n, k; readf("%d %d\n", &n, &k);
    int[] xs = stdin.readln.chomp.split(" ").map!(to!int).array;
    int[] ss = new int[xs.length+1];
    ss[0] = 0;
    for (int i = 0; i < xs.length - 1; i++) {
        ss[i+1] = ss[i] + xs[i];
    }
    int ans = int.max;
    int index = 1;
    for (int i = 0; i < xs.length - k; i++) {
        if (ans > ss[i+k] - ss[i]) {
            ans = ss[i+k] - ss[i];
            index = i + 1;
        }
    }
    index.writeln;
}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm
    , std.range
    , std.container;

void main() {
    uint n, k;
    readf("%s %s\n", &n, &k);

    //auto fence = new uint[n];
    auto sum_arr = new uint[n+2];

    uint f_sum;

    foreach(i; 0..n) {
        uint f;
        readf("%s ", &f);
        sum_arr[i+1] = f_sum + f;
        f_sum += f;
    }

    uint min = sum_arr[k] - sum_arr[0], min_idx = k+1;

    for(uint j = k; j < n+1; ++j) {
        if(sum_arr[j] - sum_arr[j - k] < min) {
            min = sum_arr[j] - sum_arr[j - k];
            min_idx = j - k + 1;
        }
    }

    min_idx.writeln;
    //foreach()
}

alias id(alias token) = token;

alias var(alias elem) = std.traits.Unqual!(typeof(elem));

auto mut(T)(auto ref T in_val) {
    std.traits.Unqual!(T) rv = in_val;
    return rv;
}

auto imut(T)(auto ref T in_val) {
    immutable immrv = in_val;
    return immrv;
}


import core.bitop, std.stdio;
void main() {
	readln;
	long a, b;
	while (readf (" %s %s", &a, &b) > 0) {
		if (a > b) a ^= b ^= a ^= b;
		writeln (!(b % a) && !((b /= a) & (b - 1)) ? (b.bsr + 2) / 3 : -1);
	}
}

import std.stdio;
import std.stdio;
import std.algorithm;
import std.range;
import std.functional;
import std.conv;
import std.string;
import std.math;
import core.bitop;

void main() {
	int tt = readln().chomp.to!int;
	foreach (t; 0 .. tt) {
		auto arr = readln().chomp.split(" ").map!(to!ulong);
		ulong a = arr[0];
		ulong b = arr[1];
		if (b < a) {
			ulong tm = a;
			a = b;
			b = tm;
		}
		if (b > a) {
			if (b % a != 0) {
				writeln(-1);
				continue;
			}
			ulong diff = b / a;
			ulong high = bsr(diff);
			if ((1UL << high) == diff) {
				writeln(
					high / 3 + (high % 3) / 2 + (high % 3) % 2
				);
			}
			else {
				writeln(-1);
			}
		}
		else {
			writeln(0);
		}
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new int[](t);
	foreach (ti; 0..t)
	{
		auto a = RD;
		auto b = RD;

		string s, s2;
		while (a != 0)
		{
			s ~= cast(char)('0'+(a%2));
			a /= 2;
		}
		while (b != 0)
		{
			s2 ~= cast(char)('0'+(b%2));
			b /= 2;
		}
		debug writeln(s);
		debug writeln(s2);

		ans[ti] = abs(cast(int)s.length - cast(int)s2.length);
		ans[ti] += 2;
		ans[ti] /= 3;
		while (s.length < s2.length)
		{
			s = '0' ~ s;
		}
		while (s.length > s2.length)
		{
			s2 = '0' ~ s2;
		}
		debug writeln(s);
		debug writeln(s2);

		foreach (i; 0..s.length)
		{
			if (s[i] != s2[i])
				ans[ti] = -1;
		}
	}

	foreach (e; ans)
	{
		writeln(e);
	}
	stdout.flush;
	debug readln;
}

import core.bitop,std.stdio;
void main(){
	readln;
	long a,b;
	while(readf(" %s %s",&a,&b)>0){
		if(a>b)a^=b^=a^=b;
		writeln(!(b%a)&&!((b/=a)&(b-1))?(b.bsr + 2)/3:-1);
	}
}

import core.bitop,std.stdio;void main(){readln;long a,b;while(readf!" %s %s"(a,b)>0)
{if(a>b)a^=b^=a^=b;writeln((b%a)|((b/=a)&(b-1))?-1:(b.bsr+2)/3);}}

import core.bitop,std.stdio;void main(){readln;long a,b;while(readf(" %s %s",&a,&b)>0){if(a>b)a^=b^=a^=b;writeln(!(b%a)&&!((b/=a)&(b-1))?(b.bsr + 2)/3:-1);}}

import core.bitop, std.algorithm, std.stdio;
void main() {
	readln;
	long a, b, r;
	while (readf (" %s %s", &a, &b) > 0) {
		if (a > b) swap (a, b);
		writeln (!(b % a) && !((b /= a) & (b - 1)) ? (b.bsr + 2) / 3 : -1);
	}
}

import core.bitop, std.algorithm, std.conv, std.stdio, std.string;
void main () {
	foreach (t; 0..readln.strip.to!int) {
		long a, b, r = -1;
		readf !(" %s %s") (a, b);
		if (a > b) swap (a, b);
		if (b % a == 0) {
			auto c = b / a;
			if (!(c & (c - 1))) r = (bsr (c) + 2) / 3;
		}
		r.writeln;
	}
}


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;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    bool[int] S;
    for (int i = 0; i * i <= 10^^6; ++i) {
        S[i*i] = true;
    }

    int ans = -(10^^6)-1;
    foreach (a; A) if (!(a in S)) ans = max(ans, a);

    ans.writeln;
}

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

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto a = readln.splitter.map !(to !(int)).array;
		int res = int.min;
		foreach (ref c; a)
		{
			auto isGood = (c < 0);
			if (!isGood)
			{
				auto d = sqrt (c * 1.0);
				isGood = (d * d != c);
			}
			if (isGood)
			{
				res = max (res, c);
			}
		}
		writeln (res);
	}
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

// floor(sqrt(a))
long floorSqrt(long a) {
  import core.bitop : bsr;
  import std.algorithm : min;
  long b = a, x = 0, y = 0;
  for (int e = bsr(a) & ~1; e >= 0; e -= 2) {
    x <<= 1;
    y <<= 1;
    if (b >= (y | 1) << e) {
      b -= (y | 1) << e;
      x |= 1;
      y += 2;
    }
  }
  return x;
}

void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto A = new long[N];
      foreach (i; 0 .. N) {
        A[i] = readLong();
      }

      long ans = long.min;
      foreach (i; 0 .. N) {
        if (A[i] != floorSqrt(A[i])^^2) {
          chmax(ans, A[i]);
        }
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}

import core.bitop, std.algorithm, std.bigint, std.compiler, std.container,
	std.conv, std.math;
import std.numeric : Fft, fft, gcd, inverseFft;
import std.random, std.range, std.stdio, std.string, std.traits, std.typecons,
	std.uni;

alias pair(X, Y) = Tuple!(X, "fi", Y, "se");
alias mp = make_pair;
alias pii = pair!(int, int);
alias pll = pair!(long, long);
// alias gcd = std.numeric.gcd;
alias lint = long;
alias rbt = RedBlackTree;
/// struct vector as c++ vector
struct Vec(T)
{
	private Array!T buf;
	alias buf this;
	this(this)
	{
		buf = buf.dup;
	}
	/// construct from length
	this(U)(U length)
			if (is(U == int) || is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint))
	{
		buf.length = length;
	}
	/// construct from length and default value
	this(U, X)(U length, X val)
			if (isImplicitlyConvertible!(X, T) || (is(U == int)
				|| is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint)))
	{
		buf.length = length;
		foreach (ref x; buf[])
		{
			x = val;
		}
	}
	/// construct from other array
	this(U)(U[] values...) if (isImplicitlyConvertible!(U, T))
	{
		buf = Array!(T)(values);
	}
	/// construct from other range
	this(Range)(Range r)
			if (isInputRange!Range && isImplicitlyConvertible!(ElementType!Range,
				T) && !is(Range == T[]))
	{
		buf = Array!(T)(r);
	}
	/// integer length
	int size() @property const
	{
		return cast(int) buf.length;
	}
}
///modulo
const int mod = 10 ^^ 9 + 7, mod2 = mod + 2;
public
{
	pure nothrow
	{
		///lcm
		T lcm(T)(auto ref T a, auto ref T b)
		{
			return a / gcd(a, b) * b;
		}
		///make_pair
		pair!(X, Y) make_pair(X, Y)(in X x_, in Y y_)
		{
			return tuple!(X, "fi", Y, "se")(x_, y_);
		}
		///BigInt greatest common divizor
		BigInt biggcd(BigInt a, BigInt b)
		{
			BigInt res = 1;
			while (b)
			{
				if ((a & 1) && (b & 1))
				{
					a -= b;
					a >>= 1;
				}
				else if (a & 1)
				{
					b >>= 1;
				}
				else if (b & 1)
				{
					a >>= 1;
				}
				else
				{
					res <<= 1;
					a >>= 1;
					b >>= 1;
				}
				if (a < b)
					swap(a, b);
			}
			return res * a;
		}
		///square
		@property X sqr(X)(in X a_)
		{
			return a_ * a_;
		}
		///cube
		@property X cub(X)(in X a_)
		{
			return a_ * a_ * a_;
		}
		///posicion lower bound
		size_t lowb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).lowerBound(g).length;
		}
		///posicion upper bound
		size_t upb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return a.length - assumeSorted(a).upperBound(g).length;
		}
		///posicion binary search
		size_t binf(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			auto pos = lowb(a, g);
			return (g == a[pos]) ? pos : a.length;
		}
		///binary search
		bool binary_search(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).contains(g);
		}
	}
	///write an array
	void putarr(X)(in X a, in char ch = ' ') if (isInputRange!X)
	{
		writefln("%(%s" ~ ch ~ "%)", a);
	}
	///write a matrix
	void putarr(X)(in X a)
			if (isInputRange!X && isInputRange!(ElementType!X) && !isSomeString!(ElementType!X))
	{
		writefln("%(%(%s %)\n%)", a);
	}
	///get an array
	bool getarr(X)(X a, in size_t n)
	{
		bool b = 1;
		foreach (ref i; a[0 .. n])
			b = input(&i);
		return b;
	}

	static if (version_minor >= 74)
	{
		///read without format
		bool input(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			return readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
		}
		///readln without format
		bool read(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			const bool fl = readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
			readln;
			return fl;
		}
	}
	else
	{
		///read without format
		bool input(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			return s == ptrs.length;
		}
		///readln without format
		bool read(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			readln;
			return s == ptrs.length;
		}
	}
	///opening file
	nothrow auto inf(in char* name)
	{
		return freopen(name, "r", core.stdc.stdio.stdin);
	}
	///closing file
	nothrow auto ouf(in char* name)
	{
		return freopen(name, "w", core.stdc.stdio.stdout);
	}
	///parsing array from line
	@property auto arread(T)()
	{
		return readln.splitter.map!(to!(T)).array;
	}
	///outbuffer
	void enter(T...)(T args)
	{
		writeln(args);
		stdout.flush;
	}
}
//foreach_reverse isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold return static heapify join filter foreach
//------------------------------------------program beginning--------------------------

void main()
{
	int n;
	read(n);
	auto a = arread!int;
	int ans = int.min;
	foreach (x; a)
	{
		if (x < 0)
		{
			ans = max(ans, x);
			continue;
		}
		int s = cast(int) sqrt(1.0L * x);
		bool fl = true;
		foreach (g; s - 2 .. s + 3)
		{
			if (x == g * g)
			{
				fl = false;
				break;
			}
		}
		if (fl)
			ans = max(ans, x);
	}
	writeln(ans);
}

import core.bitop, std.algorithm, std.bigint, std.compiler, std.container,
	std.conv, std.math;
import std.numeric : Fft, fft, gcd, inverseFft;
import std.random, std.range, std.stdio, std.string, std.traits, std.typecons,
	std.uni;

alias pair(X, Y) = Tuple!(X, "fi", Y, "se");
alias mp = make_pair;
alias pii = pair!(int, int);
alias pll = pair!(long, long);
// alias gcd = std.numeric.gcd;
alias lint = long;
alias rbt = RedBlackTree;
/// struct vector as c++ vector
struct Vec(T)
{
	private Array!T buf;
	alias buf this;
	this(this)
	{
		buf = buf.dup;
	}
	/// construct from length
	this(U)(U length)
			if (is(U == int) || is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint))
	{
		buf.length = length;
	}
	/// construct from length and default value
	this(U, X)(U length, X val)
			if (isImplicitlyConvertible!(X, T) || (is(U == int)
				|| is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint)))
	{
		buf.length = length;
		foreach (ref x; buf[])
		{
			x = val;
		}
	}
	/// construct from other array
	this(U)(U[] values...) if (isImplicitlyConvertible!(U, T))
	{
		buf = Array!(T)(values);
	}
	/// construct from other range
	this(Range)(Range r)
			if (isInputRange!Range && isImplicitlyConvertible!(ElementType!Range,
				T) && !is(Range == T[]))
	{
		buf = Array!(T)(r);
	}
	/// integer length
	int size() @property const
	{
		return cast(int) buf.length;
	}
}
///modulo
const int mod = 10 ^^ 9 + 7, mod2 = mod + 2;
public
{
	pure nothrow
	{
		///lcm
		T lcm(T)(auto ref T a, auto ref T b)
		{
			return a / gcd(a, b) * b;
		}
		///make_pair
		pair!(X, Y) make_pair(X, Y)(in X x_, in Y y_)
		{
			return tuple!(X, "fi", Y, "se")(x_, y_);
		}
		///BigInt greatest common divizor
		BigInt biggcd(BigInt a, BigInt b)
		{
			BigInt res = 1;
			while (b)
			{
				if ((a & 1) && (b & 1))
				{
					a -= b;
					a >>= 1;
				}
				else if (a & 1)
				{
					b >>= 1;
				}
				else if (b & 1)
				{
					a >>= 1;
				}
				else
				{
					res <<= 1;
					a >>= 1;
					b >>= 1;
				}
				if (a < b)
					swap(a, b);
			}
			return res * a;
		}
		///square
		@property X sqr(X)(in X a_)
		{
			return a_ * a_;
		}
		///cube
		@property X cub(X)(in X a_)
		{
			return a_ * a_ * a_;
		}
		///posicion lower bound
		size_t lowb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).lowerBound(g).length;
		}
		///posicion upper bound
		size_t upb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return a.length - assumeSorted(a).upperBound(g).length;
		}
		///posicion binary search
		size_t binf(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			auto pos = lowb(a, g);
			return (g == a[pos]) ? pos : a.length;
		}
		///binary search
		bool binary_search(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).contains(g);
		}
	}
	///write an array
	void putarr(X)(in X a, in char ch = ' ') if (isInputRange!X)
	{
		writefln("%(%s" ~ ch ~ "%)", a);
	}
	///write a matrix
	void putarr(X)(in X a)
			if (isInputRange!X && isInputRange!(ElementType!X) && !isSomeString!(ElementType!X))
	{
		writefln("%(%(%s %)\n%)", a);
	}
	///get an array
	bool getarr(X)(X a, in size_t n)
	{
		bool b = 1;
		foreach (ref i; a[0 .. n])
			b = input(&i);
		return b;
	}

	static if (version_minor >= 74)
	{
		///read without format
		bool input(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			return readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
		}
		///readln without format
		bool read(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			const bool fl = readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
			readln;
			return fl;
		}
	}
	else
	{
		///read without format
		bool input(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			return s == ptrs.length;
		}
		///readln without format
		bool read(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			readln;
			return s == ptrs.length;
		}
	}
	///opening file
	nothrow auto inf(in char* name)
	{
		return freopen(name, "r", core.stdc.stdio.stdin);
	}
	///closing file
	nothrow auto ouf(in char* name)
	{
		return freopen(name, "w", core.stdc.stdio.stdout);
	}
	///parsing array from line
	@property auto arread(T)()
	{
		return readln.splitter.map!(to!(T)).array;
	}
	///outbuffer
	void enter(T...)(T args)
	{
		writeln(args);
		stdout.flush;
	}
}
//foreach_reverse isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold return static heapify join filter foreach
//------------------------------------------program beginning--------------------------

void main()
{
	int n;
	read(n);
	auto a = arread!int;
	int ans;
	foreach (x; a)
	{
		if (x < 0)
		{
			ans = max(ans, x);
			continue;
		}
		int s = cast(int) sqrt(1.0L * x);
		bool fl = true;
		foreach (g; s - 2 .. s + 3)
		{
			if (x == g * g)
			{
				fl = false;
				break;
			}
		}
		if (fl)
			ans = max(ans, x);
	}
	writeln(ans);
}


import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      const N = readInt();
      const H = readReal();

      auto ans = new real[N];
      foreach (i; 1 .. N) {
        ans[i] = H * sqrt(1.0L * i / N);
      }
      foreach (i; 1 .. N) {
        if (i > 1) write(" ");
        writef("%.12f", ans[i]);
      }
      writeln;
    }
  } catch (EOFException e) {
  }
}

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;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto H = s[1].to!real;
    real A = H / 2;
    real B = A / N;

    auto rate = new real[](N-1);
    auto ans = new real[](N-1);
    rate[0] = sqrt(2 * B / H);
    ans[0] = H * rate[0];

    foreach (i; 0..N-2) {
        real hi = 1;
        real lo = rate[i];
        foreach (_; 0..100) {
            real mid = (hi + lo) / 2;
            real area = (rate[i] + mid) * (mid - rate[i]) * H / 2;
            if (area < B) lo = mid;
            else hi = mid;
        }
        rate[i+1] = hi;
        ans[i+1] = hi * H;
    }

    writef("%.9f", ans[0]);
    iota(1, N-1).each!(i => writef(" %.9f", ans[i]));
    writeln;
}

module main;
import std.bigint,std.container,std.array,std.algorithm,std.conv,std.parallelism,
	std.functional,std.math,std.string,std.range,std.complex,std.bitmanip,
	std.typecons,std.regex,std.random,std.uni,std.traits,std.stdio,std.variant,core.bitop,
	std.meta,core.stdc.stdio : freopen;
import std.numeric: fft,Fft,gcd,inverseFft;
alias big=BigInt;alias pair(X,Y)=Tuple!(X,"fi",Y,"se");
alias lint=long;private const int mod=1_000_000_007;
alias pii=pair!(int,int);alias pll=pair!(long,long);alias mp=make_pair;alias gcd=std.numeric.gcd;
private
{
	pure nothrow
	{
		T lcm (T)(auto ref T a,auto ref T b){return a/gcd(a,b)*b;}
		pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_){return tuple!(X,"fi",Y,"se")(x_,y_);}
		big gcd(big a,big b){while(b){a%=b;swap(a,b);}return a;}
		@property X sqr(X)(in X a_) {return a_*a_;}
		@property X cub(X)(in X a_) {return a_*a_*a_;}
		int sz(T)(T a) if(hasLength!T){return cast(int)a.length;}
		size_t lowb(T,X)(T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			size_t l=0,r=a.length;
			while(r-l>1)
			{
				auto m=(l+r)>>1;
				if(!(a[m]<g))r=m;
				else l=m;
			}
			return (!(a[l]<g))?l:r;
		}
		size_t upb(T,X)(T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			size_t l=0,r=a.length;
			while(r-l>1)
			{
				auto m=(l+r)>>1;
				if(g<a[m])r=m;
				else l=m;
			}
			return (g<a[l])?l:r;
		}
		size_t binf(T,X)(T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			auto pos=lowb(a,g);
			return (g==a[pos])?pos:a.length;
		}
		bool binary_search(T,X)(T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			return binf(a,g)!=a.length;
		}
	}
	void putarr(X)(in X a,in char ch=' ') if(isInputRange!X && !isInputRange!(ElementEncodingType!X))
	{foreach(const ref i;a)write(i,ch);}
	void putarr(X)(in X a) if(isInputRange!X && isInputRange!(ElementEncodingType!X))
	{
		foreach(ref const i;a)
		{
			foreach(ref const j;i)write(j,' ');
			writeln;
		}
	}
	bool getarr(X)(X a,in size_t n)
	{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
	bool input(T...)(auto ref T ptrs) if (ptrs.length > 0)
	{
		size_t s=0;
		foreach(ref e;ptrs)
		{
			if(isSomeChar!(Unqual!(typeof(e))))s+=readf(" %c",&e);
			else s+=readf(" %s",&e);
		}
		return s==ptrs.length;
	}
	bool read(T...)(auto ref T ptrs) if (ptrs.length > 0)
	{
		size_t s=0;
		foreach(ref e;ptrs)
		{
			if(isSomeChar!(Unqual!(typeof(e))))s+=readf(" %c",&e);
			else s+=readf(" %s",&e);
		}
		readln;
		return s==ptrs.length;
	}
	nothrow auto inf(in char* name) {return freopen(name,"r",core.stdc.stdio.stdin);}
	nothrow auto ouf(in char* name) {return freopen(name,"w",core.stdc.stdio.stdout);}
	@property auto arread(T)(){return readln.splitter.map!(to!(T)).array;}
	void enter(T...)(T args)
	{
		writeln(args);
		stdout.flush;
	}
}
//foreach_reverse isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold return static heapify join filter foreach
//------------------------------------------program beginning--------------------------
private
{

}
void main()
{
	version(ONLINE_JUDGE){}
	else
	{
		assert(freopen("input.txt","r",core.stdc.stdio.stdin));
		assert(freopen("output.txt","w",core.stdc.stdio.stdout));
	}
	int n,h;
loop:while(read(n,h))
	{
		foreach(i;1..n)
		{
			writef("%.10f ",h*sqrt(i*1.0000L/n));
		}
		debug writeln;
	}
}


// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int n, m;
string s, t;

void main() {
    scan(n, m);
    scan(s);
    scan(t);

    if (n > m) {
        swap(n, m);
        swap(s, t);
    }

    int[] ans = new int[](2000);

    foreach (i ; 0 .. m - n + 1) {
        int[] tmp = new int[](0);

        debug {
            writeln("s:", s);
            writeln("t:", t);
        }

        foreach (j ; 0 .. n) {
            if (s[j] != t[j]) {
                tmp ~= j + 1;
            }
        }

        if (tmp.length.to!int < ans.length.to!int) {
            ans = tmp.dup;
        }

        t.popFront();
    }

    writeln(ans.length);
    writefln("%(%s %)", ans);
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

import std.stdio;
import std.string;
import std.algorithm;
import std.exception;
import std.conv;
import std.array;
import std.range;
import std.math;

int CompareToStrings ( dstring first, dstring second )
{
	//writeln(first, second);
	int returnVal = 0;
	zip(first, second).each!( a => a[0] == a[1] ? returnVal++ : returnVal );
	//writeln(returnVal);
	return returnVal;
}

int[] FindDiffPositions ( dstring first, dstring second )
{
	int[] returnVal;
	for ( int i = 0; i < first.length; i++ )
	{
		if ( first[i] != second[i] )
			returnVal ~= (i + 1);
	}
	return returnVal;
}

void main()
{
    auto ilkSatir = stdin.readln.strip.split().map!(a => to!int(a)).array();
	auto s = stdin.readln.strip.to!dstring;
	auto t = stdin.readln.strip.to!dstring;

	int pos = 0;
	int max = 0;
	for ( int i = 0; i <= t.length - s.length; i++ )
	{
		int curVal = CompareToStrings( s, t[i..i+s.length]);
		if ( curVal > max )
		{
			pos = i;
			max = curVal;
		}
	}

	auto curList = FindDiffPositions( s, t[pos..pos+s.length]);
	writeln( s.length - max );
	curList.each!(a => write(a, " "));
}

import std.stdio;
import std.string;
import std.algorithm;
import std.exception;
import std.conv;
import std.array;
import std.range;
import std.math;

int CompareToStrings ( dstring first, dstring second )
{
	//writeln(first, second);
	int returnVal = 0;
	zip(first, second).each!( a => a[0] == a[1] ? returnVal++ : returnVal );
	//writeln(returnVal);
	return returnVal;
}

int[] FindDiffPositions ( dstring first, dstring second )
{
	int[] returnVal;
	for ( int i = 0; i < first.length; i++ )
	{
		if ( first[i] != second[i] )
			returnVal ~= (i + 1);
	}
	return returnVal;
}

void main()
{
    auto ilkSatir = stdin.readln.strip.split().map!(a => to!int(a)).array();
	auto s = stdin.readln.strip.to!dstring;
	auto t = stdin.readln.strip.to!dstring;

	int pos = 0;
	int max = 0;
	for ( int i = 0; i <= t.length - s.length; i++ )
	{
		int curVal = CompareToStrings( s, t[i..i+s.length]);
		if ( curVal > max )
		{
			pos = i;
			max = curVal;
		}
	}

	auto curList = FindDiffPositions( s, t[pos..pos+s.length]);
	writeln( s.length - max );
	writeln( curList );
}


import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        long[] ls, aa, bb; get(ls); get(aa); get(bb);

        long x = abs(aa[1] - bb[1]) + 2, res;
        foreach (i; 2..N) {
            auto a = aa[i];
            auto b = bb[i];
            if (a > b) swap(a, b);
            res = max(res, x + ls[i-1] - 1);
            if (a == b) {
                x = 2;
            } else {
                x += 2 + a-1 + ls[i-1]-b;
                x = max(x, b - a + 2);
            }
        }
        res = max(res, x + ls[$-1] - 1);
        writeln(res);
    }
}

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

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto c = readln.splitter.map !(to !(int)).array;
		auto a = readln.splitter.map !(to !(int)).array;
		auto b = readln.splitter.map !(to !(int)).array;
		long res = 0;
		long cur = c[n - 1] - 1;
		foreach_reverse (i; 1..n)
		{
			cur += 2;
			if (a[i] > b[i])
			{
				swap (a[i], b[i]);
			}
			res = max (res, cur + b[i] - a[i]);
			cur = max (cur, b[i] - a[i]);
			cur += c[i - 1] - b[i];
			cur += a[i] - 1;
			if (a[i] == b[i])
			{
				cur = c[i - 1] - 1;
			}
		}
		writeln (res);
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new long[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto c = RDA;
		auto a = RDA(-1);
		auto b = RDA(-1);

		long tot;
		foreach (i; 1..n)
		{
			if (i == 1)
			{
				tot += abs(a[1] - b[1]) + 2;
			}
			else
			{
				if (a[i] != b[i])
				{
					tot += min(a[i], b[i]) + c[i-1] - 1 - max(a[i], b[i]) + 2;
					tot.chmax(abs(a[i] - b[i]) + 2);
				}
				else
				{
					ans[ti].chmax(tot + c[i-1] - 1);
					tot = 2;
				}
			}
			ans[ti].chmax(tot + c[i] - 1);
			debug writeln("i:", i, " tot:", tot, " ans:", ans[ti]);
		}
	}

	foreach (e; ans)
		writeln(e);
	stdout.flush;
	debug readln;
}

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        int[] ls, aa, bb; get(ls); get(aa); get(bb);

        int x = abs(aa[1] - bb[1]) + 2, res;
        foreach (i; 2..N) {
            auto a = aa[i];
            auto b = bb[i];
            if (a > b) swap(a, b);
            res = max(res, x + ls[i-1] - 1);
            if (a == b) {
                x = 2;
            } else {
                x += 2 + a-1 + ls[i-1]-b;
                x = max(x, b - a + 2);
            }
        }
        res = max(res, x + ls[$-1] - 1);
        writeln(res);
    }
}

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        int[] ls, aa, bb; get(ls); get(aa); get(bb);

        int x = abs(aa[1] - bb[1]) + 2, res;
        foreach (i; 2..N) {
            auto a = aa[i];
            auto b = bb[i];
            if (a > b) swap(a, b);
            res = max(res, x + ls[i-1] - 1);
            if (a == b) {
                x = 2;
            } else {
                x += 2 + a-1 + ls[i-1]-b;
            }
        }
        res = max(res, x + ls[$-1] - 1);
        writeln(res);
    }
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new long[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto c = RDA;
		auto a = RDA(-1);
		auto b = RDA(-1);

		long tot;
		foreach (i; 1..n)
		{
			if (i == 1)
			{
				tot += abs(a[1] - b[1]) + 2;
			}
			else
			{
				if (a[i] != b[i])
					tot += min(a[i], b[i]) + c[i-1] - 1 - max(a[i], b[i]) + 2;
				else
				{
					ans[ti].chmax(tot + c[i-1] - 1);
					tot = 2;
				}
			}
			ans[ti].chmax(tot + c[i] - 1);
			tot.chmax(abs(a[i] - b[i]));
			debug writeln("i:", i, " tot:", tot, " ans:", ans[ti]);
		}
	}

	foreach (e; ans)
		writeln(e);
	stdout.flush;
	debug readln;
}

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

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto c = readln.splitter.map !(to !(int)).array;
		auto a = readln.splitter.map !(to !(int)).array;
		auto b = readln.splitter.map !(to !(int)).array;
		long res = 0;
		long cur = c[n - 1] - 1;
		foreach_reverse (i; 1..n)
		{
			cur += 2;
			if (a[i] > b[i])
			{
				swap (a[i], b[i]);
			}
			cur = max (cur, b[i] - a[i]);
			res = max (res, cur + b[i] - a[i]);
			cur += c[i - 1] - b[i];
			cur += a[i] - 1;
			if (a[i] == b[i])
			{
				cur = c[i - 1] - 1;
			}
		}
		writeln (res);
	}
}