
// Make newform 354.4.a.i in Magma, downloaded from the LMFDB on 19 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_354_a();"
// To make the coeffs of the qexp of the newform in the Hecke field type "qexpCoeffs();"
// To make the newform (type ModFrm), type "MakeNewformModFrm_354_4_a_i();".
// 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_354_4_a_i();".
// 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 := [106740, -108942, 13255, 3376, -492, -2, 1];
        Kf := NumberField(Polynomial([elt : elt in poly]));
        AssignNames(~Kf, ["nu"]);
    end if;
    Rf_num := [[1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [-5652168, 2400944, 27671, -1329, -193, -13], [-234148170, 13689193, 5325430, -312546, -7448, 553], [343017204, -124448624, -13275017, 3480099, -8189, -7181], [1566708, -1502633, -19199, 34935, -353, -74]];
    Rf_basisdens := [1, 1, 348948, 3315006, 6630012, 58158];
    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_354_a();"
function MakeCharacter_354_a()
    N := 354;
    order := 1;
    char_gens := [119, 61];
    v := [1, 1];
    // 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;

function MakeCharacter_354_a_Hecke(Kf)
    return MakeCharacter_354_a();
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+1)]];
    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 := [[2, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0], [3, 1, 0, 0, 0, 0], [4, 0, 0, 0, 1, 0], [11, -1, 0, 0, -1, 1], [16, -1, 1, 0, 0, -1], [39, 0, -3, 1, -2, -1], [17, -3, 0, -2, -2, -1], [16, -4, 2, -1, -4, 2], [25, -3, 4, -1, -6, 0], [11, -11, 0, -1, 2, 4], [1, -13, 4, -2, 1, 4], [26, 12, -8, 0, 1, -6], [62, -6, -10, 3, 7, -2], [-49, 4, 9, 4, 11, 5], [-55, 25, -2, 2, 14, -6], [-59, 0, 0, 0, 0, 0], [3, 7, 8, 9, -6, 10], [9, 20, -11, 3, -5, -1], [-152, 5, -3, -6, 8, -3], [35, 12, 3, -2, -41, 5], [-98, 12, 0, -9, 11, -14], [28, -22, -14, 18, -1, 0], [-286, -43, 39, -1, 9, 16], [9, -26, 9, 15, 9, 13], [-399, 16, -27, -6, 26, 5], [-232, 1, -9, -23, 11, -9], [-302, -62, 10, -1, 4, -8], [-84, -23, 23, -18, -21, -17], [-111, 4, -29, 27, 41, -37], [461, 22, -17, 29, -47, -33], [-431, -75, -6, -9, -104, 11], [-756, 62, 38, -13, -33, -4], [-166, 87, -3, 22, -3, 28], [-901, 30, -29, -17, -20, 1], [-531, 103, 12, 1, 108, -10], [233, 37, 22, 16, -4, -36], [254, 51, -5, 13, 77, -48], [-1299, -33, -20, -9, -2, 22], [-698, -90, -18, 12, 119, -30], [-1190, 96, -36, -21, -69, -62], [355, 6, 33, -10, -13, -3], [-1133, -2, -3, 15, -81, 85], [619, -36, 3, -20, 0, -3], [-1198, 45, 59, 13, 97, 25], [625, 120, -5, 32, 37, -1], [5, -20, 77, 15, 134, 47], [321, 60, 31, -50, -26, 57], [-479, -232, -35, 1, 20, -35], [792, -47, 17, -37, -70, 107], [-189, 199, 28, 11, -72, -31], [-369, -203, -70, 40, -84, -2], [1430, -89, 61, -61, 54, -40], [-225, -34, -59, 23, -45, -49], [-509, 106, 77, -2, 116, 85], [-364, 107, 25, -29, -98, -23], [186, 36, 42, -7, 11, 4], [1432, 8, 42, -73, -171, 76], [2087, 102, -57, 59, 185, 43], [1833, -16, -15, -24, -30, 63], [2375, 76, -53, 55, 102, -77], [1950, -111, -103, -32, -9, -113], [1947, 33, -32, -51, 132, 13], [1795, -153, -124, 76, -53, -24], [3554, -184, 62, 31, -58, 78], [3025, 173, -110, 14, 166, 70], [647, 137, 72, 87, 132, -27], [3666, 154, 4, -7, 56, -160], [10, 77, -87, 33, 349, -40], [1106, -109, 99, -80, -154, 153], [3480, 172, 36, -47, 102, 130], [-1887, 383, 224, -91, 291, 56], [75, -3, 70, 90, -252, -32], [1240, 358, -2, -15, -48, 26], [-1071, 82, -77, -23, -5, -15], [434, -299, 187, 22, -32, 229], [4018, -133, 29, -49, -267, 171], [1699, -209, 46, -32, 144, 84], [3969, 457, 74, -92, 130, -133], [468, -412, 138, -96, 222, -176], [-857, -114, 103, 114, 176, 15], [-906, 197, -371, 126, 64, 23], [-45, 416, 9, -92, -167, -43], [1720, 597, 151, 50, -206, 14], [-7837, -76, -33, -149, -320, -103], [1219, -152, 19, -67, 316, -185], [1584, 10, -162, -17, 109, -40], [-435, -566, -25, -30, 107, 177], [2330, -481, 279, -34, 477, 85], [-5010, -117, -335, 88, 61, 21], [-1690, 363, 119, 9, 98, -8], [-4350, 261, 175, -98, 407, 135], [-6297, 696, -213, 177, -112, -39], [-2919, 186, 9, 88, -299, 275], [-3875, -258, -249, -9, -275, -27], [-395, -398, -227, 210, -107, -97], [-1993, 52, 103, 214, -151, 83], [-3617, 42, -135, -8, 539, 31], [-2293, -526, 81, 17, -169, -29], [-374, 51, 215, -126, 94, 21], [-7070, 18, -22, -109, 20, -174], [-4676, -749, 171, 11, -15, -3], [-2510, -61, -111, 110, -435, -276], [887, 332, 331, 74, -599, 101], [-389, -106, 9, 113, 43, 83], [8499, 209, 308, -94, 1, -119], [2113, 827, -398, -42, 291, -197], [-5773, 1024, -209, 162, 993, -307], [-9629, 241, 108, -165, 927, -128], [6216, -456, -160, -37, -698, 82], [1756, -150, 276, 45, -101, 246], [4049, 865, -144, -115, -67, -92], [-1657, -168, 481, -1, 572, 201], [-3351, 246, -65, -115, -631, 149], [-4148, -192, 362, -147, 217, 336], [9101, -122, 225, -111, -521, 201], [4396, 754, -44, -195, 444, 176], [3688, -577, 93, 47, -959, 211], [-4211, 1131, -574, 97, 90, -346], [8966, -706, -10, 53, -74, 2], [11215, 1152, -137, -174, 177, 5], [5468, -1224, 558, -148, -778, 88], [6312, -1105, 175, -83, 125, -27], [-5743, 1049, 536, -114, -147, 131], [89, 716, 307, -100, 60, -229], [376, 514, -316, 234, -85, -456], [3834, -202, -2, 106, -98, -228], [-2302, 1158, -474, -151, 858, -320], [-2157, 910, -625, 134, 678, -291], [10899, -904, 341, 67, -353, 255], [-1313, 288, -185, -409, -324, 91], [3666, 367, 173, -60, 73, -161], [11406, 371, -277, 325, -171, 5], [3878, -1160, 90, -31, 104, 100], [10191, 398, -25, -87, 497, -673], [8222, 476, 374, 51, -118, 218], [-15788, -274, 160, 78, 72, 28], [17851, 373, 48, -29, 708, -207], [-4007, 370, 83, -148, 796, 43], [-11555, -389, -164, 274, 280, -549], [9455, 350, -185, 124, -278, 209], [4364, 2, 388, -160, 437, -78], [2717, 489, -436, 244, -990, 184], [-2813, -206, 201, -227, -231, -193], [-9169, 62, -219, -254, -1015, -27], [917, 606, 47, -279, -1037, 399], [-2844, 838, -342, 509, -184, -148], [-160, 317, -109, -32, 391, -182], [2004, -1464, -80, -338, 1028, 70], [-10146, 18, 294, -239, -818, 44], [15650, -28, -200, -268, -538, 154], [-807, -2157, 482, 55, -764, 455], [-5652, 420, -60, -356, -392, 108], [2593, 42, 135, 553, -149, 681], [4366, 783, -739, 284, 445, -316], [6456, -2101, -255, -303, 624, -3], [-20424, 779, 625, -123, -957, 445], [-824, 767, -827, 144, -1177, -330], [5795, -916, -367, 341, 843, -67], [-5071, -1914, 733, -295, 1531, -223], [6791, 1896, 301, -110, 235, -695], [-23473, -1738, -115, 62, -546, -77], [11024, -1403, 417, 52, -215, 803], [8884, 836, 134, -467, 424, -618], [4623, 542, 239, 547, 27, 229], [-16095, -1190, -177, -259, 95, -461], [2608, -643, 61, 138, 861, 305], [6527, 860, 619, -62, 1103, 531], [-19710, 602, -390, 72, 1212, -638], [-2273, -614, -187, -252, -52, -117], [2583, -1022, 113, -605, -1869, 649], [32483, -1027, -354, 107, 205, -198], [14975, 609, -414, -324, 575, -266], [-20959, 1274, 285, -481, 1437, 95], [10929, -114, 373, -568, -346, -271], [16358, 968, -1026, -217, 771, -740], [9586, -407, -61, -84, -387, 140], [3781, 426, 527, 304, -808, 787], [-10474, 1876, 140, 383, 304, 432], [-9366, 1504, -884, 168, -876, -116], [-1102, -566, 88, -4, 492, -232], [37338, -962, 564, -70, -46, -92], [8706, 985, 389, 598, -424, 43], [2432, -8, 474, -80, -1142, 1390], [4340, 935, -769, 292, -52, -775], [5664, 12, 1032, -699, -1068, 618], [1934, 1425, -317, 285, 831, -1185], [4259, 250, 111, 36, 706, 49], [-17931, 604, 575, -475, -63, 693], [16552, 830, 556, 339, -270, -152], [-36111, -374, -979, -249, -801, 79], [-18967, -983, 684, -60, -1627, 1099], [10537, -1514, 69, -188, 646, 769], [5285, -873, 1010, -157, 508, 650], [13248, -820, -1080, 412, -662, -814], [-3951, -793, -700, -678, 1038, -549], [14172, -1660, 1440, 263, -604, 146], [-16708, 219, 1083, -783, 948, 693], [8646, 1503, -551, -203, 1411, -1228], [-26942, -1378, -330, -267, 1446, -404], [-9936, -2491, 1161, 247, -851, 983], [2473, 1698, 743, -427, -271, 123], [17442, -86, -12, 479, 3416, -448], [4400, -1164, -532, 563, -680, 138], [41992, -1286, -354, 752, 326, 758], [-17936, -546, -164, 20, 1663, -1148], [-23275, 1193, -544, 1014, 1706, -754], [14378, -2271, 219, 418, -846, 384], [-8853, -373, 562, 4, -378, 277], [31339, 2492, -979, -506, -864, 75], [3354, -1478, 896, -293, -878, -606], [24207, 2437, 700, -118, -144, 464], [-42829, -596, -165, 365, 712, -63], [-6046, -322, -248, -88, -1688, 80], [20068, -3163, -1055, -278, 842, -551], [20776, 214, -550, 1029, -1214, -396], [19476, -762, -1072, -715, 121, -998], [12706, -1532, 760, 276, 811, -322], [16992, 338, 648, -129, -2318, 1288], [-9857, -3807, -444, 464, -440, 940], [39506, -207, -291, 86, 1484, 523], [-17775, 1069, 716, -460, 2020, 952], [15882, 4606, 466, -100, 1346, -812], [-33943, 1470, 1961, -296, -1189, 759], [18259, 2778, 1747, -752, 1748, 103], [-11478, 111, 1433, -459, -168, 1075], [-12444, 890, -1050, -353, -626, -1234], [12076, 360, -936, -134, 1212, -1516], [3514, -3667, 873, 229, -2713, 1175], [57682, -280, -536, -29, 780, -280], [18888, -351, -671, 251, -948, -381], [5966, 3760, 500, 275, -1077, 1160], [-74, 3011, 685, 454, 1409, 215], [-7065, -2552, -311, -625, 1425, 521], [-20412, 1598, 114, 372, -746, -328], [-27339, -1403, 580, -64, 90, 938], [-17873, -2702, -757, 85, -2135, -521], [-28043, 2144, 1681, -564, 779, 549], [17827, 1370, -979, 371, 2455, -161], [47034, 2551, 871, -593, 68, -579], [3601, -4524, -847, -373, 795, 423], [15859, -2370, 595, -12, -132, 605], [-10174, 2058, -186, 933, -1107, 1116], [-31838, -1614, 158, 388, -1782, 1026], [-33887, 1398, -563, 251, -1276, -1129], [32526, -551, -1739, 1431, -2624, -605], [24119, 1129, -998, 68, -1932, 326], [45820, 2164, -522, 607, -1019, 1236], [-8959, -640, -901, 694, 383, -795], [-53210, -1319, 515, -74, -172, -323], [-12676, -762, -914, 427, -210, 1426], [-39108, -3378, -1218, 567, -1734, -150], [-43835, -1062, -203, -54, 1331, -189], [-18879, -2953, 1148, -62, -2819, 1215], [8847, -3035, -992, -160, 394, -384], [57161, -1278, -913, 275, 2293, -265], [22641, -4306, -247, -119, -1541, 171], [17462, -2236, -1018, 312, -1182, -462], [173, -2372, -849, -679, -1519, -603], [-39062, -5343, 1713, 482, 320, 1464], [-40863, 2257, -1000, -32, -670, -260], [-45571, -648, -1767, 771, -1501, 601], [26556, 1412, 38, -1112, -1540, 616], [15862, -2012, -644, -940, 1380, -1442], [-18415, -1732, 251, -363, -351, 629], [-615, -952, -1269, 154, -1908, -1729], [-27202, -1403, 61, -484, 2927, -1221], [36816, 952, 1034, -262, 1240, 1434], [-33927, 1462, -873, 17, -337, -1207], [-25427, -167, -158, 150, -908, -622], [29144, -657, -261, 591, -693, 1347], [59916, 1459, -503, -185, -1149, 410], [-1116, -1686, -1686, 601, -1064, -654], [12242, -1772, 2152, -483, -2177, 220], [18198, 2036, -2214, 847, 2479, -1584], [-23654, 17, -933, 88, 1749, -225], [-18907, -3638, 897, -926, 1009, 1045], [-9093, -4644, 453, -731, 923, 1765], [17083, -3182, -917, -385, 635, -1851], [46205, -1494, -361, -259, -371, 299], [-15582, -857, -1479, -1572, -222, 57], [44434, -2071, 1777, -1841, -643, 497], [-9112, 1366, -6, -174, 274, -768], [-16305, -235, 1602, -381, -1363, -726], [-64155, -2502, -773, 673, -599, -699], [-14795, 714, -3335, 2284, 1571, -683], [39637, -4170, 1273, -1451, -1615, -187], [20424, 1317, -2741, 1392, -357, -1215], [37579, -769, -44, 680, -872, -2590], [63410, 3748, -524, 648, -3100, 832], [616, -1062, 126, 1703, 413, 566], [-33940, 5296, -348, 442, -2906, -2162], [33296, -1202, -1490, 635, -1366, -162], [19448, 984, -30, 265, -415, -2356], [-41579, -5062, -195, 391, -2747, 133], [37450, -1508, 2026, 481, 343, 690], [-19044, -2436, 212, 340, -2923, -1772], [50465, -2325, -196, 1156, -210, 1116], [-41703, 4777, -346, 593, 1219, -885], [20987, 974, 1065, -467, -4701, 2053], [15881, 4914, -2397, -582, 1073, -2593], [-24106, 924, -2474, 1333, 1073, 740], [51469, -1673, -514, 1246, -204, 954], [9425, -1758, 481, 738, -3332, 2049], [-27527, 1205, -2218, -155, 1676, -577], [-11819, -2824, -577, 695, 2375, 189], [-18063, 350, 715, 967, 59, -1257], [26782, -1995, 2287, -2089, -914, 1193], [71169, -2032, 1875, -272, -869, 1421], [16794, -2881, 1289, 1143, -1175, 2201], [-39208, -6667, -1687, 1292, -552, 139], [36690, -1479, -1431, -1766, -1053, -437], [-4126, -10, -348, -1175, 2243, -1570], [-8536, -3996, 3696, -1016, -3603, 634], [-69463, 2083, -1350, 256, 559, 634], [47447, 2318, -405, 515, -1889, 1281], [72981, -1648, 1295, -1382, 797, 645], [8412, -3005, 3535, 270, -2598, 351], [47783, -633, 368, 153, 1510, 745], [3550, -2546, -1252, -245, 665, -2468], [53300, -5384, 1100, -526, -1942, 40], [32712, 5386, 32, -978, -1568, -664], [-15711, 2069, -1052, 879, 2444, 908], [-15436, -660, -676, -250, 1988, -518], [22579, -2936, 185, -1865, 1371, 923], [-5010, -3584, 2932, -992, -2102, 126], [45760, -362, -1936, 1199, -2021, -832], [18214, 3640, -3582, -474, 1904, -986], [-31870, -32, -530, 276, -3414, -2776], [-33487, -1656, 2317, 1040, 3967, 1259], [-72541, 2355, -1686, 1038, -1081, -118], [35826, -2036, 760, 374, -3108, -640], [11838, 2151, -2677, 335, -1919, 145], [-10157, 2606, -1435, -587, 5487, -805], [36894, -1850, 38, -2411, -3554, 1146], [11763, -772, 3021, -2294, -4249, 2217], [-3787, 1824, -2419, -180, -4515, -255], [6447, 8501, -902, 625, 326, 213], [-77669, 4830, -619, 914, 4761, -707], [-66727, -372, -1659, -377, 3543, 91], [121784, 1498, 1748, 842, 746, -1550], [-13190, 615, -841, 2234, 3691, -1184], [-25263, -700, 2121, 1034, -898, 325], [17004, 763, 1017, -797, 2801, -353], [-123425, 182, -727, 472, -914, 1251], [-20548, -1264, -366, -549, -6479, 672], [57412, -2675, -1401, -2554, -448, 213], [-12774, -5532, 2446, -132, -1816, 738], [-56235, 2996, -1435, -491, -7105, -45], [-33111, -3032, 983, 1573, -827, 2345], [-21906, 2902, -2514, 1743, 2778, -3002], [40658, 1006, 2114, 1240, -1793, -208], [-63071, -901, 1146, -1105, 6068, 218], [18051, -2421, 522, -679, -2264, 1702], [32565, -2864, -287, -214, -5239, 449], [60626, -28, 1716, -1614, 138, 116], [-82046, -932, 3070, 34, -3264, 5024], [-19473, 1030, 2619, -506, -2395, -783], [-43202, -3390, -1300, -1753, -5600, 1858], [-25092, 2961, 373, 3254, 1540, 315], [-60118, 4773, -2619, 1608, -1316, -1145], [-96075, 480, 2103, -127, 2188, 243], [-92531, 1161, -1382, -421, -189, -528], [-41026, 5964, -424, -867, -1405, -1430], [114446, -647, -3967, -335, 1869, -2048], [61795, -5212, -1133, -1630, -3295, -1335], [30825, 5812, -1747, -396, 4540, -2873], [54577, 1834, 2617, -452, 2154, 1047], [-51754, 1022, -4258, 1182, -4462, -1402], [-51771, 8004, -1021, 394, 6857, -1449], [4762, -2900, 2628, 1727, -3145, 3162], [-3433, 7904, -653, 355, 917, -2497], [-31950, -2867, 761, 1148, -3617, 711], [-48314, 1399, 4955, -1361, -2853, 2337], [-15863, 998, 3787, -46, 2067, 625], [6225, 3871, 942, -568, 908, -269], [-27638, -4278, -1506, -2565, -5616, 334], [-35229, -7852, 4967, -432, 1957, 1085], [-43809, 2201, 246, 561, 4354, -935], [-51618, 3683, 127, -820, 991, -308], [67254, 1065, 519, 711, -665, 433], [-2580, -2375, 2777, -1021, 2755, 1638], [64291, 7580, -2961, 543, -2322, -1033], [-18784, -2807, -1625, 104, 4321, -2134], [-27751, 3666, 951, 331, 679, -2239], [-154863, -1026, 411, -1083, 1167, 747], [-14024, 3530, 644, -1973, -5611, 230], [-31107, -6256, 893, 1116, -4719, 151], [-81091, 2483, -1894, 1758, -2660, -1613], [-51769, -8034, 2025, -1337, 111, -1269], [-17553, 5880, -3499, 767, 1363, -3839], [28863, 3016, -2179, 97, -596, -1813], [1668, 3731, -625, -408, 1958, 2378], [76535, -2566, -225, 370, 856, -1543], [-4465, 1122, -1337, -1864, -3439, 411], [36702, 2186, 4638, -2624, 4154, 598], [-90601, -982, 2279, -40, -1399, -227], [4574, -1086, 826, -2586, 54, -2254], [-5635, -4681, -1558, -864, 4884, -1641], [22761, 3503, 824, -2104, -728, -324], [-4537, 852, 1105, 1049, -1843, 151], [-26337, -4047, -578, 897, -2738, -623], [-44079, -6172, -1869, 2548, 1766, 769], [111538, -5228, 924, 1426, 1711, 3486], [78218, -7175, -79, -1126, -1451, -229], [-124239, 5943, -1518, 2094, -962, 572], [74038, 4069, 87, -239, 2375, -1933], [23021, 938, -2169, 1816, -4966, -4039], [-27322, 9590, -654, 303, 5051, -2428], [22113, 5788, -5179, 37, -557, -2101], [-10232, -7821, 5033, -1808, 5002, -338], [-53273, -1929, 3544, 735, 5794, 1088], [-35498, -1018, 2322, -1405, 5042, 1454], [37988, 677, 229, 420, -6211, 2570], [60585, 4745, -606, 1172, -2727, 567], [7714, -1835, -2121, -2989, -263, 1009], [-101614, -2426, 2456, -910, -5312, 1166], [33929, 5629, -1374, -1769, -4388, 1424], [69139, -11124, 301, -1963, 2231, -847], [-38658, -807, -4011, -621, -6952, -451], [44854, 5766, -4224, -817, -2980, -640], [-24535, 920, -6105, 1515, -4069, -1321], [51324, -903, 2969, 374, -9799, 2287], [215028, -4076, 2628, -1316, -284, 938], [-20925, -1484, -3821, 3440, -3040, 1637], [3310, 529, 3591, -1853, -4347, 2717], [-53464, 1546, 3208, -2103, -5156, 1356], [-7654, 360, 796, 3000, 1147, 2076], [-3263, 8200, -3733, 374, 1399, -3907], [72089, -1833, -322, -1910, -4380, -810]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_354_a_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_354_4_a_i();".
// 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_354_4_a_i(:prec:=6)
    chi := MakeCharacter_354_a();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 4));
    S := BaseChange(S, Kf);
    maxprec := NextPrime(2999) - 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_354_4_a_i();".
// 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_354_4_a_i( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_354_a();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,4,sign)));
    Vf := Kernel([<5,R![423072, -46452, -41942, 8560, -327, -20, 1]>],Snew);
    return Vf;
end function;