
// Make newform 350.4.g.a in Magma, downloaded from the LMFDB on 25 May 2026.
// To make the character of type GrpDrchElt, type "MakeCharacter_350_g();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_350_g_Hecke();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_350_4_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_350_4_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function ConvertToHeckeField(input: pass_field := false, Kf := [])
    if not pass_field then
        poly := [3410793604, 0, -2718915464, 0, 1669993424, 0, -379411788, 0, 39810581, 0, -1629024, 0, 31178, 0, -284, 0, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-8814346494926447, 0, -5400248304152, 0, 3291049356640, 0, -700176302564, 0, 65231524415, 0, -1812261472, 0, 20350730, 0, -81940, 0], [2238303424831338230354, 0, -978738100382270649492, 0, 115677228609425731129, 0, -10436267231352705295, 0, 449112820236289844, 0, -9179436724016573, 0, 88255907784765, 0, -324163433602, 0], [-32502949499236, 0, 28240113514266, 0, -6437287617593, 0, 541029014183, 0, -19823933998, 0, 357984445, 0, -3153465, 0, 10874, 0], [-815449877933893739962, 0, 1730358563282982847710, 0, -563546149607278384841, 0, 74133648628735130414, 0, -3284735697162414175, 0, 65592967500374146, 0, -614824303733136, 0, 2213413924994, 0], [-6212601898800890722840, 0, 5398603007175809716392, 0, -1227899448825946519994, 0, 102627508066074718034, 0, -3704543255136992740, 0, 65702297488606975, 0, -568530290194146, 0, 1928693300459, 0], [0, 108526464770162091754815248, 0, -38310665133574980578760354, 0, 7787924513159113871151898, 0, -781062197800320128570857, 0, 31592134941595180065530, 0, -602360370400340985692, 0, 5479240542884544240, 0, -19283249881353589], [0, -51701106621773227164434024, 0, 38310665133574980578760354, 0, -7787924513159113871151898, 0, 781062197800320128570857, 0, -31592134941595180065530, 0, 602360370400340985692, 0, -5479240542884544240, 0, 19283249881353589], [0, 17794630559963631893859652, 0, 18228245590978253898814206, 0, -7289232724646784073551928, 0, 1027290466718267470949797, 0, -46055094302430433480796, 0, 918861764104292412614, 0, -8567708279169251520, 0, 30623155208509687], [0, 55945981083101808700, 0, -88577679130749104734, 0, 23909513331435277452, 0, -2501458152005202389, 0, 101638789153486116, 0, -1938856220460802, 0, 17641050123700, 0, -62111701515], [-502026589065754842052976196, -578354655897075995514431560, 1068650153880200327967619152, 428558086317020165930540532, -347473194399084012044692704, -87081548871126453110104988, 45602133971724096081377412, 8727126965659565029483322, -2005956761198275211619207, -352336969408752981986530, 39682219910670051018360, 6705672975574420388968, -368179308417845295147, -60902781051722802150, 1311532169334028692, 214065309374333378], [502026589065754842052976196, -578354655897075995514431560, -1068650153880200327967619152, 428558086317020165930540532, 347473194399084012044692704, -87081548871126453110104988, -45602133971724096081377412, 8727126965659565029483322, 2005956761198275211619207, -352336969408752981986530, -39682219910670051018360, 6705672975574420388968, 368179308417845295147, -60902781051722802150, -1311532169334028692, 214065309374333378], [-1381501653204897460364030376, 199166256573195850173084200, 602925937551080086725447420, 203899783728972536854308852, -69955477458892401264251748, -81525771031908617453696384, 6109822573983466728292056, 11487085373053609155758306, -244966856062406265542568, -514598496648613968735544, 4707911460440241423951, 10256495051434103125906, -43202533689420577500, -95525825961841413936, 153181915673465139, 341024064182904140], [1381501653204897460364030376, 199166256573195850173084200, -602925937551080086725447420, 203899783728972536854308852, 69955477458892401264251748, -81525771031908617453696384, -6109822573983466728292056, 11487085373053609155758306, 244966856062406265542568, -514598496648613968735544, -4707911460440241423951, 10256495051434103125906, 43202533689420577500, -95525825961841413936, -153181915673465139, 341024064182904140], [0, -14191159630267128258187404, 0, 5008088248747650613279044, 0, -1016943138150762964291024, 0, 101801193722976952797082, 0, -4098622810703965498975, 0, 77841544572120382592, 0, -705922723281394395, 0, 2478516889494874], [0, -1776142253119066166120, 0, 2813718538836662905400, 0, -758966836682890027200, 0, 79297342767237017254, 0, -3210422061359245368, 0, 60992812746035447, 0, -552793809824240, 0, 1939479430857]];
    Rf_basisdens := [1, 865787919726267, 973003632553489000212, 28437039855882, 973003632553489000212, 486501816276744500106, 28412679074194432295190612, 28412679074194432295190612, 28412679074194432295190612, 33709164058568963556, 56825358148388864590381224, 56825358148388864590381224, 56825358148388864590381224, 56825358148388864590381224, 350773815730795460434452, 101127492175706890668];
    Rf_basisnums := ChangeUniverse([[z : z in elt] : elt in Rf_num], Kf);
    Rfbasis := [Rf_basisnums[i]/Rf_basisdens[i] : i in [1..Degree(Kf)]];
    inp_vec := Vector(Rfbasis)*ChangeRing(Transpose(Matrix([[elt : elt in row] : row in input])),Kf);
    return Eltseq(inp_vec);
end function;


// To make the character of type GrpDrchElt, type "MakeCharacter_350_g();"
function MakeCharacter_350_g()
    N := 350;
    order := 4;
    char_gens := [127, 101];
    v := [3, 2];
    // chi(gens[i]) = zeta^v[i]
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    F := CyclotomicField(order);
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),[F|F.1^e:e in v]);
    return MinimalBaseRingCharacter(chi);
end function;

// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_350_g_Hecke();"
function MakeCharacter_350_g_Hecke( : Kf := false)
    N := 350;
    order := 4;
    char_gens := [127, 101];
    char_values := [[0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
    assert UnitGenerators(DirichletGroup(N)) eq char_gens;
    values := ConvertToHeckeField(char_values : pass_field := ISA(Type(Kf), Fld), Kf := Kf); // the value of chi on the gens as elements in the Hecke field
    F := Universe(values);// the Hecke field
    chi := DirichletCharacterFromValuesOnUnitGenerators(DirichletGroup(N,F),values);
    return chi;
end function;


function ExtendMultiplicatively(weight, aps, character)
    prec := NextPrime(NthPrime(#aps)) - 1; // we will able to figure out a_0 ... a_prec
    primes := PrimesUpTo(prec);
    prime_powers := primes;
    assert #primes eq #aps;
    log_prec := Floor(Log(prec)/Log(2)); // prec < 2^(log_prec+1)
    F := Universe(aps);
    FXY<X, Y> := PolynomialRing(F, 2);
    // 1/(1 - a_p T + p^(weight - 1) * char(p) T^2) = 1 + a_p T + a_{p^2} T^2 + ...
    R<T> := PowerSeriesRing(FXY : Precision := log_prec + 1);
    recursion := Coefficients(1/(1 - X*T + Y*T^2));
    coeffs := [F!0: i in [1..prec]];
    coeffs[1] := 1; //a_1
    for i := 1 to #primes do
        p := primes[i];
        coeffs[p] := aps[i];
        b := p^(weight - 1) * F!character(p);
        r := 2;
        p_power := p * p;
        //deals with powers of p
        while p_power le prec do
            Append(~prime_powers, p_power);
            coeffs[p_power] := Evaluate(recursion[r + 1], [aps[i], b]);
            p_power *:= p;
            r +:= 1;
        end while;    
    end for;
    Sort(~prime_powers);
    for pp in prime_powers do
        for k := 1 to Floor(prec/pp) do
            if GCD(k, pp) eq 1 then
                coeffs[pp*k] := coeffs[pp]*coeffs[k];
            end if;
        end for;
    end for;
    return coeffs;
end function;


function qexpCoeffs()
    // To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
    weight := 4;
    raw_aps := [[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1, 0, 0, -3, 0, 0, 1, 0, 0, 0, 0, 0], [-2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0], [0, 0, 0, 0, -13, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, -7, -7, 0, 0], [0, 0, 0, -45, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 8], [0, 0, 0, 0, 0, 0, 0, 78, 0, 0, -12, -12, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 10], [0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 13, 13, 0, 0], [0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -60, 0, 0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0, -40, 0, 0, 0, 0, 0, 0, 0, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 16], [0, 0, 0, 0, 0, 0, 0, -174, 0, 0, -11, -11, 0, 0, 0, 0], [232, -28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, -16, 0, 0], [0, 0, 0, -517, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, -15, 0, 0], [0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -119, 0, 0, 0, 0, 0, 27, -27, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, -14], [0, 0, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, -32, 0, 0], [0, 0, 0, 0, 0, 0, 0, 366, 0, 0, 29, 29, 0, 0, 0, 0], [0, 0, 0, 607, 0, -95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 570, 0, 0, 0, -42, -42, 0, 0], [0, 0, 0, 0, 0, 0, 0, 222, 0, 0, -55, -55, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -130, 0, 0, 0, 0, 0, -50], [0, 0, 0, 0, 0, 0, 0, -798, 0, 0, -42, -42, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 168, 0, 0, 0, 0, 0, 0, 0, -54, 0], [0, 0, 0, -1206, 0, -156, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-734, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 408, 0, 0, 0, 0, 0, 64, -64, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -726, 0, 0, 0, 21, 21, 0, 0], [0, 0, 0, 0, 153, 0, 0, 0, 0, 0, -36, 36, 0, 0, 0, 0], [0, 0, 421, 0, 0, 0, 0, 0, 0, 0, 0, 0, -59, 59, 0, 0], [0, 0, 0, 288, 0, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, -38], [-1546, 289, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1830, 0, 0, 0, -22, -22, 0, 0], [0, 0, 0, 0, 0, 0, 0, -870, 0, 0, 24, 24, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -236, 0, 0, 0, 0, 0, 0, 0, -52, 0], [2350, -237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, -96, 0, 0], [0, 0, 0, 0, 141, 0, 0, 0, 0, 0, -132, 132, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -50, 0, 0, 0, 0, 0, 0, 0, -82, 0], [0, 0, 0, 0, 0, 0, 0, 0, -348, 0, 0, 0, -264, -264, 0, 0], [0, 0, 0, -1539, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 114], [0, 0, 0, 0, 0, 0, 0, 0, 0, 184, 0, 0, 0, 0, 0, 86], [0, 0, 0, 0, 436, 0, 0, 0, 0, 0, -100, 100, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 2730, 0, 0, 0, 19, 19, 0, 0], [0, 0, 0, 0, 0, 0, 340, 0, 0, 0, 0, 0, 0, 0, 164, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 0, 0, 0, 0, 0, 140], [0, 0, 0, 0, 0, 0, 0, -3060, 0, 0, -82, -82, 0, 0, 0, 0], [1524, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, -92, 0, 0], [0, 0, -291, 0, 0, 0, 0, 0, 0, 0, 0, 0, -219, 219, 0, 0], [0, 0, 0, 0, 691, 0, 0, 0, 0, 0, -152, 152, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 60], [0, 0, -131, 0, 0, 0, 0, 0, 0, 0, 0, 0, -211, 211, 0, 0], [0, 0, 0, 0, 0, 0, 0, 3084, 0, 0, 154, 154, 0, 0, 0, 0], [524, -124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -672, 0, 0, -204, -204, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -5160, 0, 0, -23, -23, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -606, 0, 0, 0, 0, 0, 0, 0, -126, 0], [0, 0, -951, 0, 0, 0, 0, 0, 0, 0, 0, 0, -303, 303, 0, 0], [0, 0, 0, -3492, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -1149, 0, 0, 0, 0, 0, -188, 188, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -1242, 0, 0, 0, 4, 4, 0, 0], [0, 0, 0, -1288, 0, -1100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, -55, 55, 0, 0], [0, 0, 0, 8781, 0, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, -535, 0, 0, 0, 0, 0, 195, -195, 0, 0, 0, 0], [4888, -499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, -374, 0], [0, 0, 0, 0, 0, 0, -20, 0, 0, 0, 0, 0, 0, 0, 86, 0], [1704, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [306, 1503, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1412, 0, 0, 0, 0, 0, 0, 0, 0, 0, -120, 120, 0, 0], [0, 0, 0, 0, 0, 0, -740, 0, 0, 0, 0, 0, 0, 0, -424, 0], [0, 0, 0, 0, 0, 0, 0, 0, -2700, 0, 0, 0, 125, 125, 0, 0], [0, 0, 0, -11361, 0, 277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1014, 0, 0, 158, 158, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, -266], [0, 0, 0, 0, 0, 0, 0, 0, -1560, 0, 0, 0, 443, 443, 0, 0], [0, 0, 0, 0, -1235, 0, 0, 0, 0, 0, -148, 148, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -354, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -6402, 0, 0, 47, 47, 0, 0, 0, 0], [-470, 1061, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 9535, 0, -413, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, -837, 0, 0, 0, 0, 0, 0, 0, 0, 0, 360, -360, 0, 0], [0, 0, 0, 0, 0, 0, -732, 0, 0, 0, 0, 0, 0, 0, -138, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -94, 0, 0, 0, 0, 0, -440], [0, 0, -482, 0, 0, 0, 0, 0, 0, 0, 0, 0, 537, -537, 0, 0], [6372, -541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 780, 0, 0, 199, 199, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 552, 0, 0, -978, -978, 0, 0, 0, 0], [0, 0, -1574, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, -115, 0, 0], [0, 0, 0, -4974, 0, 548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-4092, -76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2781, 0, 0, 0, 0, 0, -85, 85, 0, 0, 0, 0], [0, 0, 0, 0, 2386, 0, 0, 0, 0, 0, 461, -461, 0, 0, 0, 0], [0, 0, -1015, 0, 0, 0, 0, 0, 0, 0, 0, 0, -463, 463, 0, 0], [0, 0, 0, 6699, 0, 1019, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -376, 0, 0, 0, 0, 0, 598], [0, 0, 0, 0, 229, 0, 0, 0, 0, 0, -32, 32, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 2496, 0, 0, 0, -250, -250, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1152, 0, 0, -160, -160, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -238, 0, 0, 0, 0, 0, 0, 0, -74, 0], [-1274, -1475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [-1886, -700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16, 16, 0, 0], [0, 0, 0, 0, -2830, 0, 0, 0, 0, 0, 775, -775, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, -108, -108, 0, 0], [0, 0, 0, -14283, 0, -1047, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 532, 0, 0, 0, 0, 0, 536], [0, 0, 0, 0, 0, 0, 0, 0, -3894, 0, 0, 0, -806, -806, 0, 0], [0, 0, 0, 0, -3297, 0, 0, 0, 0, 0, 813, -813, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 360, 0, 0, 0, -383, -383, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -1556, 0, 0, 0, 0, 0, 566], [-2520, -1899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4397, 0, -289, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -1282, 0, 0, 0, 0, 0, 0, 0, 664, 0], [0, 0, 0, 0, 4270, 0, 0, 0, 0, 0, -23, 23, 0, 0, 0, 0], [0, 0, -889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 423, -423, 0, 0], [0, 0, 0, -3683, 0, 753, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 2418, 0, 0, 0, -749, -749, 0, 0], [-4098, -2527, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, -192, 0, 0, 406, 406, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -714, 0, 0, 0, 0, 0, 660], [0, 0, 0, 0, 0, 0, 2392, 0, 0, 0, 0, 0, 0, 0, 356, 0], [0, 0, -1545, 0, 0, 0, 0, 0, 0, 0, 0, 0, 219, -219, 0, 0], [0, 0, 0, 0, -2367, 0, 0, 0, 0, 0, -292, 292, 0, 0, 0, 0], [0, 0, 0, 0, -1609, 0, 0, 0, 0, 0, 589, -589, 0, 0, 0, 0], [0, 0, 0, 33921, 0, 711, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -752, 0, 0, 0, 0, 0, 458], [2960, 2083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, -2940, 0, 0, 0, 859, 859, 0, 0], [0, 0, 0, 0, 0, 0, 0, 5634, 0, 0, -1437, -1437, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -302, 0, 0, 0, 0, 0, 0, 0, 8, 0], [0, 0, 0, 0, 0, 0, -618, 0, 0, 0, 0, 0, 0, 0, -288, 0], [0, 0, 3648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 476, -476, 0, 0], [0, 0, 0, 0, 3652, 0, 0, 0, 0, 0, -868, 868, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -2580, 0, 0, 0, 0, 0, 0, 0, -366, 0], [0, 0, 0, 0, 0, 0, 0, 0, 2916, 0, 0, 0, -161, -161, 0, 0], [0, 0, 0, 0, 0, 0, 0, -16602, 0, 0, -552, -552, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, -758], [0, 0, 0, 0, 0, 0, 0, 0, -17100, 0, 0, 0, 263, 263, 0, 0], [0, 0, 0, 0, 3090, 0, 0, 0, 0, 0, 303, -303, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 14760, 0, 0, 343, 343, 0, 0, 0, 0], [21576, -1020, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, -2647, 0, -311, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, -632, 0, 0, 0, 0, 0, 0, 0, -790, 0], [0, 0, 0, 0, -3393, 0, 0, 0, 0, 0, -1211, 1211, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -338, 0, 0, 0, 0, 0, 62], [0, 0, 0, 0, 0, 0, 0, 840, 0, 0, -883, -883, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 5526, 0, 0, 0, -782, -782, 0, 0], [0, 0, 0, 0, 0, 0, 0, -5874, 0, 0, 1463, 1463, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, -2530, 0, 0, 0, 0, 0, -1358], [0, 0, 0, 0, 0, 0, 0, 11262, 0, 0, 1614, 1614, 0, 0, 0, 0], [0, 0, 977, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1360, 1360, 0, 0], [-2240, 3732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3485, 0, 0, 0, 0, 0, 575, -575, 0, 0, 0, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_350_g_Hecke( : Kf := Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_350_4_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose lines below.
// The precision argument determines an initial guess on how many Fourier coefficients to use.
// This guess is increased enough to uniquely determine the newform.
function MakeNewformModFrm_350_4_g_a(:prec:=16)
    chi := MakeCharacter_350_g();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(997) - 1;
    while true do
        trunc_vec := Vector(Kf, [0] cat [f_vec[i]: i in [1..prec]]);
        B := Basis(S, prec + 1);
        S_basismat := Matrix([AbsEltseq(g): g in B]);
        if Rank(S_basismat) eq Min(NumberOfRows(S_basismat), NumberOfColumns(S_basismat)) then
            S_basismat := ChangeRing(S_basismat,Kf);
            f_lincom := Solution(S_basismat,trunc_vec);
            f := &+[f_lincom[i]*Basis(S)[i] : i in [1..#Basis(S)]];
            return f;
        end if;
        error if prec eq maxprec, "Unable to distinguish newform within newspace";
        prec := Min(Ceiling(1.25 * prec), maxprec);
    end while;
end function;


// To make the Hecke irreducible modular symbols subspace (type ModSym)
// containing the newform, type "MakeNewformModSym_350_4_g_a();".
// This may take a long time!  To see verbose output, uncomment the SetVerbose line below.
// The default sign is -1.  You can change this with the optional parameter "sign".
function MakeNewformModSym_350_4_g_a( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_350_g();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<3,R![53824, 0, 0, 0, 4577, 0, 0, 0, 1]>],Snew);
    return Vf;
end function;