
// Make newform 400.6.n.g in Magma, downloaded from the LMFDB on 25 April 2024.
// To make the character of type GrpDrchElt, type "MakeCharacter_400_n();"
// To make the character of type GrpDrchElt with Codomain the HeckeField, type "MakeCharacter_400_n_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_400_6_n_g();".
// 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_400_6_n_g();".
// 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 := [579398322543528055824, 0, 12044868290803250652, 0, 824105698447750789, 0, 14779507781220031, 0, 133816049059481, 0, 881545050522, 0, 5522961902, 0, 25993614, 0, 109637, 0, 271, 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, 0, 0, 0, 0], [212921716884714662875950751269719918403828850980812371621009654452509498784, 0, -33441375709226160814560456495802626668443090358687425930576472335126440, 0, -2313486545053723009075373035464891423145662774321644569645912951679806, 0, -40818835425889522342412858697530102841300340233417330488842896833667, 0, -313769331178029471606870593672327933555213909438831508201350845196, 0, -2283893436271639799803265840075175126403286393278841933772278152, 0, -14975053792722239714333261085314809703129317194617101514605030, 0, -9224633755010780812621394298508623732189022264141377822548, 0, -278966884584704062280862741583431714660045819236968932666, 0, 210400331102341975409110825343262820701324269652042317, 0], [-59796125630963059484035166165480637448609841792711444396589450967058527355119355424, 0, -4694568982569663806549064471932609969040735625526239944457222378533864358844700032, 0, -73614286430072414530431753660035155608759248821305759309557363125303938993793100, 0, -335310271155398505096641366509820275833033651493727600702225465758601184635239, 0, -3278016091113470405134441776508163090092543595849759389960296599985660582156, 0, -9237036172073909176672032966501542630592021952043346717918699668388264508, 0, -77739791695821221383548835088518683952445325930572822979313112249812926, 0, 12203048923274079101852228086462556785400965909229586981163211171204, 0, -823738617909189420141037064086996144862371928996999202111974981216, 0, 1254178201903086938983596921272517853931781219766635397959349945, 0], [-608253713169809036864264185808952068082935949677321659804934045581708109425958876064, 0, -52412735939141917376905505849506166354148269418675124962917660953660762383716928688, 0, -740164094101256784342783818193066418737738230013164804958043379833308737590398152, 0, -2739980764117147926399619106731427285908241579947756930288431486697273163733809, 0, -26551844488220156065599407637174625031595745862887935970303680234764976663332, 0, -91668445253109693283373561113445527829822441802271688152626159352446477996, 0, -571760714583308176694756005168009095476896032697858476165340979263430962, 0, 283012807146205189566496402892382592928369398399145648470169192652284, 0, -7512049644645830170034644999821760652164877475491862158056769764468, 0, 24149316727365752594945821778906611950385179541104452232083931439, 0], [0, 270653852870948730415923446110967787053901407919555138816, 0, 7790599041755809878147583197352567438110371075388086098, 0, 65832656485941088483992505346167562554007310732561481, 0, 397259589404908264340147924407228629361190583337211, 0, 2650767627421112057961519499794583468657453402944, 0, 11635548063570412080782330375522433956768004218, 0, 49451056125307788404889920477821889857562550, 0, 74358224365241399186793090561872683641038, 0, 489242999668271915742583949711241730081, 0, -1006960252745120275502695105610275157], [253783608376364286527761201929219162502119767907473696288257642706931651806984873184710351712, -17162167873039593409602831774131269708642871820797857005975241513649840049259956738428727408, 18784160384636618993161611960238312013287070462999033722635080055937206711924045874319433744, 2629195134447001561264606146553540851777450704667114348375711089072783541945383071289339600, 318270693789373478286413751767722346666610697612000674187586279938200668272753479866982536, 55893699828325254674553543082744388027231232059319898298130934241728437319992382811411257, 2817550859552603228108119745447063376836059260909250426515165340920483753714393192614607, 525849839393235470151411847164834352630024351702874577932165124325275714907864430430007, 18488459780373702075397057318198130933924789101782497963563610789476069273208748241756, 3527715755560062108135074024461318209617853590673037816954813126546655936115025483192, 113261700409322868867493804014756920367788707294674493017015307262815888752037833908, 22412301784201615716542407587198864723074157086765114766613173635994823841933788230, 521977964723250684349394094165582675622968261075284001418457240058895332303124046, 106936218508929505906961924386372273599493489270517587627668332767883131350570986, 2140818884581458191517392773692967029125664303737952480990781983201459403585468, 455049765462529979205429248790618057289885814442913082229665537272063108926344, 5354303562565174803679947999463721109917937929280937981989964499513958091164, 1124334669769758814541492811759235884518470896952688986729039623535781643149, 18340192937068380232030963437985986414011819536922057094427033527312011183, 4230657967813760091232890131439507191928963942574938331730198835879591331], [253783608376364286527761201929219162502119767907473696288257642706931651806984873184710351712, 17162167873039593409602831774131269708642871820797857005975241513649840049259956738428727408, 18784160384636618993161611960238312013287070462999033722635080055937206711924045874319433744, -2629195134447001561264606146553540851777450704667114348375711089072783541945383071289339600, 318270693789373478286413751767722346666610697612000674187586279938200668272753479866982536, -55893699828325254674553543082744388027231232059319898298130934241728437319992382811411257, 2817550859552603228108119745447063376836059260909250426515165340920483753714393192614607, -525849839393235470151411847164834352630024351702874577932165124325275714907864430430007, 18488459780373702075397057318198130933924789101782497963563610789476069273208748241756, -3527715755560062108135074024461318209617853590673037816954813126546655936115025483192, 113261700409322868867493804014756920367788707294674493017015307262815888752037833908, -22412301784201615716542407587198864723074157086765114766613173635994823841933788230, 521977964723250684349394094165582675622968261075284001418457240058895332303124046, -106936218508929505906961924386372273599493489270517587627668332767883131350570986, 2140818884581458191517392773692967029125664303737952480990781983201459403585468, -455049765462529979205429248790618057289885814442913082229665537272063108926344, 5354303562565174803679947999463721109917937929280937981989964499513958091164, -1124334669769758814541492811759235884518470896952688986729039623535781643149, 18340192937068380232030963437985986414011819536922057094427033527312011183, -4230657967813760091232890131439507191928963942574938331730198835879591331], [0, 8827430527390069084973727173864174511733632698041671642713654743508223175272329699970096, 0, 253552395984786611768650565757441741650585630729312797331521775568100935949645110204908, 0, 2189224116229524315576963446464171121161354311220864927208336053327673039714298111651, 0, 13628625349652377746851434398045516216063793667004531989698068792958889044011271891, 0, 87442259165914346983580089570161341062064115499418090406831691146869890129974344, 0, 366190396849314274777354474854616715535624264636942836506627740282474090470858, 0, 1652694776464585428207261794167015727044208324629297228555331359136280720970, 0, 1488430266105155651334385077298065382008025838715140183836944681663597948, 0, 16130740673164040674592902656481835440943453036512979941935902782845191, 0, -46082710053615539660258221582126619513821655200202188229362204520217], [-732037542271813752099723267528817931728922091682808553708848980254418981034376380344320, 30796806205557039344780935140872394813597292502992226094748304639765159090595299214288, -4344716348643164963478779095655983118459070868928255907380719691158419476617868796000, 1420587098842060058586771022078986116677968080337281929388134963741522859378387238004, -464020830567363731325613483076444485434897085521256208656707436883568360077232987240, -27062611457198888884392299468476549793309613086226885205142756385856206635803725947, -5087310752855588496542903176180685573366544738170304769418087643767752977872554905, -375892968403452201435322635194955456397548437720383787007194268113876225246077477, -36213863995028074637977294947421098168703456651766916503282385320480929544951940, -2464339107426684342262514785007997568022292006829698109163082175469335753138728, -249699204749614310733620725203845554629944947557950677218558277566560303652780, -19685121256176575815919731003459384229129343307552767681820978860591016308106, -1151876142573784201200094462361940298856140993723516644041509261256663802450, -85309725222293673091547568294549452772172094610909928200790463293033598070, -6343960684148244742681582653243914857089886574075399402132225403025616820, -549798412485781753337075064687192162430443348678546155283380317722466876, -10847169678235915758491182817392986708950156512009050167199110607776340, -821829022015373578955423947785378437221339234230070011486705692409647, -68763073417443610669580451886968209280075232960399241157959751764745, -6594225930105869392959299502142987859769498283419521816971442542721], [3280546249699492947339631969928033179682926530973171534959370118791930073819414513839200, -30796806205557039344780935140872394813597292502992226094748304639765159090595299214288, -4974930702140597677239352472614853437519976778236930196019118156349365197963093414200, -1420587098842060058586771022078986116677968080337281929388134963741522859378387238004, -507619288955957921199213792189436625494352260595367896811115100927943935232725580170, 27062611457198888884392299468476549793309613086226885205142756385856206635803725947, -5856555900008667172594340039269147089025091844184412049207377966520486692987846790, 375892968403452201435322635194955456397548437720383787007194268113876225246077477, -42126956145155396166738247730121450057275893390600951456511308409787325901675320, 2464339107426684342262514785007997568022292006829698109163082175469335753138728, -292739970713074973336262381620531279952159072297829276967011712104180159282340, 19685121256176575815919731003459384229129343307552767681820978860591016308106, -1434086238433148274228131302489130759388124148737800537105253911559761697100, 85309725222293673091547568294549452772172094610909928200790463293033598070, -6517802114857114334553669054942802362007156003954549164021051521889945760, 549798412485781753337075064687192162430443348678546155283380317722466876, -16104397620782494914873558644919225858331689339764324793727361880192570, 821829022015373578955423947785378437221339234230070011486705692409647, -64798006017279033019772035133465265474010925686772092889318196807110, 6594225930105869392959299502142987859769498283419521816971442542721], [-2727856685617857411776184688578724610138896330737797984625083169730021633554311862811488, 30796806205557039344780935140872394813597292502992226094748304639765159090595299214288, 29139589504450357555697929771694726042828163305368547722520345274660937718814466324440, 1420587098842060058586771022078986116677968080337281929388134963741522859378387238004, 3162607433112979384887274402319576686952050990045696025473768979124072275576546291842, -27062611457198888884392299468476549793309613086226885205142756385856206635803725947, 33956734517578307403108867670585725062205559219681388177654998960271659583832910242, -375892968403452201435322635194955456397548437720383787007194268113876225246077477, 225479704476831228888423856929790852910870969492622788492390052847484425255443272, -2464339107426684342262514785007997568022292006829698109163082175469335753138728, 1569464447258239237507389536196431799548308513931847114977720448846811234419940, -19685121256176575815919731003459384229129343307552767681820978860591016308106, 7579849448194265349328230004059558991258987507674218436943434493900695814276, -85309725222293673091547568294549452772172094610909928200790463293033598070, 37146831952233435068328671349290346150839094492272628394765079524691293904, -549798412485781753337075064687192162430443348678546155283380317722466876, 80350502254480008285887118601335396477932236341353019211027252132547394, -821829022015373578955423947785378437221339234230070011486705692409647, 405031039775231913355355633376487760186925084075170592924564137144866, -6594225930105869392959299502142987859769498283419521816971442542721], [14981027507983144379125732023798681159866129390348647145916925422393853188555228917508048, -4363152485155286549639532821091852158137782979853887659344787493478931629398091135341728, -87514339197710830482120058175583443763452190636579467353024689084201411721642606028040, -114882111928189900120777604431871610003212948734562865407608087336868128392292650444094, -9325636978787378744411433889260333358489957428445763766610847107299236504520252742822, -1769879323847056602123078636893704916632667127916934554556708235881175942876621983517, -102141953595925277554395143670359548035294190876471146739901825784176772045643296942, -15339924088594012109828075160087421553635598949932520336446765757195371509149527153, -676970107575955514346311764336046199702699030487336604059848622497345604831111832, -98384928211145055302891940302966413885377891062239647399495964046921626739135632, -4686171039872393562483749555003753642579248604779585608180495693900843148866220, -593482108245906451272115342934880323543622101483360387894676029551906790643418, -23028194005519854053902561247484083404413852248640636061608870759102288355996, -2763265122862671091250606858615005627270770246012090774222431483223094542194, -101850646582724706382588046425786163399020225110683698441566805913294375984, -11103001203025384307099266883682612529332268246387723577281180835579196210, -236586260139134217220880746456733900289764295271486892257287019550158374, -28493737783760924972345005882495970102000410848331226036055366633583501, -1007394101759476399006113742070854062642771137853455221626069125756206, -100784666031729110078354367817198492855465558928434122161872584288561], [-14981027507983144379125732023798681159866129390348647145916925422393853188555228917508048, -4363152485155286549639532821091852158137782979853887659344787493478931629398091135341728, 87514339197710830482120058175583443763452190636579467353024689084201411721642606028040, -114882111928189900120777604431871610003212948734562865407608087336868128392292650444094, 9325636978787378744411433889260333358489957428445763766610847107299236504520252742822, -1769879323847056602123078636893704916632667127916934554556708235881175942876621983517, 102141953595925277554395143670359548035294190876471146739901825784176772045643296942, -15339924088594012109828075160087421553635598949932520336446765757195371509149527153, 676970107575955514346311764336046199702699030487336604059848622497345604831111832, -98384928211145055302891940302966413885377891062239647399495964046921626739135632, 4686171039872393562483749555003753642579248604779585608180495693900843148866220, -593482108245906451272115342934880323543622101483360387894676029551906790643418, 23028194005519854053902561247484083404413852248640636061608870759102288355996, -2763265122862671091250606858615005627270770246012090774222431483223094542194, 101850646582724706382588046425786163399020225110683698441566805913294375984, -11103001203025384307099266883682612529332268246387723577281180835579196210, 236586260139134217220880746456733900289764295271486892257287019550158374, -28493737783760924972345005882495970102000410848331226036055366633583501, 1007394101759476399006113742070854062642771137853455221626069125756206, -100784666031729110078354367817198492855465558928434122161872584288561], [1216332819928660499338900079553195498908767269898860435134747911340671435139283264, -88432651264923737925002965214469547882101476463237948077749664532151242222051840, 90590291585116677293945091276000038879707181560666390793777000910429000689306528, 12883655646506043279696389938919333316689098192014203411177655773230108946535240, 1521997439099170806962756743988331856532101846959419882707863098361268038011216, 267540304591032032386542623815792174661734623661040506962124445390532127260600, 12207054826177618295760852071827025999871445623329938059450825068156647439644, 2610966656378605836625918057643064028721000818755163028876649768160093745520, 86694088162260185202396818663708871364528136955258749710805733250403764992, 16856311254573044517854232158816694697286968243616427789004431372590983920, 487430568197167607134852623661172889412342812916690294895344775881366240, 111883696306336445793887392544342566707159630427409303628671779634212080, 2512723643330123556987307946290305874121525981065114409964005357679336, 516406090449901578832140043500174214773028110788498686739228568801120, 8902273859703430424916693257120243581653244157488344891505248330592, 2323131833038903026020264164323198622159749768330786957967453275240, 27016264166325774676646838372335767353087407996276907320690435216, 5464047769473140051316424047021857516164333511910134422421557560, 72650364454909820403715679958316104529329542289444493338837068, 22054230584639543509288230614195225746164667049201513602197360], [-1216332819928660499338900079553195498908767269898860435134747911340671435139283264, -88432651264923737925002965214469547882101476463237948077749664532151242222051840, -90590291585116677293945091276000038879707181560666390793777000910429000689306528, 12883655646506043279696389938919333316689098192014203411177655773230108946535240, -1521997439099170806962756743988331856532101846959419882707863098361268038011216, 267540304591032032386542623815792174661734623661040506962124445390532127260600, -12207054826177618295760852071827025999871445623329938059450825068156647439644, 2610966656378605836625918057643064028721000818755163028876649768160093745520, -86694088162260185202396818663708871364528136955258749710805733250403764992, 16856311254573044517854232158816694697286968243616427789004431372590983920, -487430568197167607134852623661172889412342812916690294895344775881366240, 111883696306336445793887392544342566707159630427409303628671779634212080, -2512723643330123556987307946290305874121525981065114409964005357679336, 516406090449901578832140043500174214773028110788498686739228568801120, -8902273859703430424916693257120243581653244157488344891505248330592, 2323131833038903026020264164323198622159749768330786957967453275240, -27016264166325774676646838372335767353087407996276907320690435216, 5464047769473140051316424047021857516164333511910134422421557560, -72650364454909820403715679958316104529329542289444493338837068, 22054230584639543509288230614195225746164667049201513602197360], [-171747706573185830768979937190722008771962237312878413924018030445643858302360327976685964464, 11433494798328147370272868530747899617584005690578366508961433013028761091603074286150082368, -12547903210681689961909921223679204229709565528976700944456902701666762466137232340967882980, -1718634721679007249140142481867308379976539219902877985313800984928295686052646968281403200, -216195119593993722070348608610288572335144456934618424745848363656939491829063176465313339, -36605971104707284080979150924501011490837146609734815034350773834815523718983943829175952, -2063767939573548308464767869738511940534691076665862190197111604401660802948292594714824, -328284697204450405518346038774267792909716864796165561993055593361366678630187224917827, -13205070794623472765228332756327159146160488850744259384097190273772077804892447039984, -2227970201594634146618353776294962356556609589874137346611440886581961502031585209512, -86335725118611666821035492676043730805641426912153588657621707364873513208335245250, -13879029881293473845917071364715443072480360516471155185948274560356648330915556200, -395301710401579217817181856688511150819801186034685414961882769805916968851329672, -67394149725657087887102149969895645930982338144459700137776970096962257640471746, -1770115289293190708079611056653420534222140714859531274617133678018481884563468, -276992294378642344158527042451090923686847278384791944692095751899787962922184, -4109294106559471402578046215602183498451557341709868074979788387699964725063, -716825157889424621641732313380782631197233595486641083206165721402194873304, -16601555304561930891448347845424379281634416607761223608635630738230276112, -2552940148085548801069681610107534882591304810521946145551001042875792511], [171747706573185830768979937190722008771962237312878413924018030445643858302360327976685964464, 11433494798328147370272868530747899617584005690578366508961433013028761091603074286150082368, 12547903210681689961909921223679204229709565528976700944456902701666762466137232340967882980, -1718634721679007249140142481867308379976539219902877985313800984928295686052646968281403200, 216195119593993722070348608610288572335144456934618424745848363656939491829063176465313339, -36605971104707284080979150924501011490837146609734815034350773834815523718983943829175952, 2063767939573548308464767869738511940534691076665862190197111604401660802948292594714824, -328284697204450405518346038774267792909716864796165561993055593361366678630187224917827, 13205070794623472765228332756327159146160488850744259384097190273772077804892447039984, -2227970201594634146618353776294962356556609589874137346611440886581961502031585209512, 86335725118611666821035492676043730805641426912153588657621707364873513208335245250, -13879029881293473845917071364715443072480360516471155185948274560356648330915556200, 395301710401579217817181856688511150819801186034685414961882769805916968851329672, -67394149725657087887102149969895645930982338144459700137776970096962257640471746, 1770115289293190708079611056653420534222140714859531274617133678018481884563468, -276992294378642344158527042451090923686847278384791944692095751899787962922184, 4109294106559471402578046215602183498451557341709868074979788387699964725063, -716825157889424621641732313380782631197233595486641083206165721402194873304, 16601555304561930891448347845424379281634416607761223608635630738230276112, -2552940148085548801069681610107534882591304810521946145551001042875792511], [0, 141478471343823512756359945375336628315339084477798808501135659828029193085734001921456, 0, -19672597102313489094674551635951987145902446359549119248380373728399945693285703164800, 0, -391366030402316378767772629091302678296153710942337101345975582694486589657233481669, 0, -4377044878391597712240953523932819779235326948350494070521218274302895888448735559, 0, -26131481790391634302546039213627510980233456856039948552179623124939833673740024, 0, -190189259666597462363848052948983042862596134671222202014275993023000697919710, 0, -807230133557139008842989731038490778993104952534447476503822378172062125722, 0, -4085588282168293010882196798456348394410173217147837486128998458927135128, 0, -8095083767850165448458480955614088924217563397924219719567747291026713, 0, -39987050250562948147897383326215467740586257943398640512410715625347], [0, 14613733659312684872537194175407278365194184773495547230324794599318087673062557093686384, 0, 379110553704341413349869851218787013484822958495936821248366494566985878840165038081740, 0, 6325828040872959927630018478088808401924121052178936910382401818753340531445574864399, 0, 56644747308851601352659249697346413399295858431283990147053226400297392664382934559, 0, 370653100390829684350959638394827902380271570829893647608152948655986371401983144, 0, 2317273532858759645105269347902614314464762207848356538839519129209008345937330, 0, 10843431729581792996877539843695426762064168728039085543382116446420705881842, 0, 46214965156220827640155496053705537791951100887266694195254147203556772988, 0, 111800915166392298818834472809280632867095513367061494746455144985119363, 0, 417608737188634207215433331907388601567436907242832966420798401261827], [0, -4457506665318583672436403775778164946329234274709816873495820402779800338378645367959152, 0, 673692792816527849445029451662254242874510838409638125445006367344601549470296057755280, 0, 13838353067581885601255838278853775589462525865775136480070349316548095540083047738073, 0, 152603859737567883711834230082370403877072029366126878420475427719367805782703879943, 0, 950963524999849124320116397963233231746946100820642546014353850048195196961029048, 0, 6603334110785680947144582436728016953217566504102075455655425367078799306677510, 0, 30017121592200848573473612419320041823495922660048811318215633541072610359114, 0, 148188113585514551301623109355225624067216829002944935227664160266319014856, 0, 307291733472471275277468079400639692100407071297317791092727918734845101, 0, 1518606803028165481250139400177346079323417302232770275518622003477299]];
    Rf_basisdens := [1, 1164227184275943945387258608552202612034150114666456738434723143667920208, 1121593795036841302747795238795074935160995345367722863674317311680848775917882360, 2243187590073682605495590477590149870321990690735445727348634623361697551835764720, 1619470712350716559357342343605013280292390449171456207120, 26997541333217662794877007504102301468410242316917527086857935133089376075861387361550312480, 26997541333217662794877007504102301468410242316917527086857935133089376075861387361550312480, 285223459475750235540780183659457618995607605773845025956197679264366810445003775451120, 21940266113519248887752321819958278384277508136449617381245975328028216188077213496240, 21940266113519248887752321819958278384277508136449617381245975328028216188077213496240, 21940266113519248887752321819958278384277508136449617381245975328028216188077213496240, 285223459475750235540780183659457618995607605773845025956197679264366810445003775451120, 285223459475750235540780183659457618995607605773845025956197679264366810445003775451120, 20594622537908943325626914763241537788961266363285532782210928349135808039946005, 20594622537908943325626914763241537788961266363285532782210928349135808039946005, 2249795111101471899573083958675191789034186859743127257238161261090781339655115613462526040, 2249795111101471899573083958675191789034186859743127257238161261090781339655115613462526040, 30700933544867999885005444230771847941952032037542163142399274861025113462631727370840, 285223459475750235540780183659457618995607605773845025956197679264366810445003775451120, 184205601269207999310032665384631087651712192225252978854395649166150680775790364225040];
    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_400_n();"
function MakeCharacter_400_n()
    N := 400;
    order := 4;
    char_gens := [351, 101, 177];
    v := [2, 4, 3];
    // 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_400_n_Hecke();"
function MakeCharacter_400_n_Hecke(Kf)
    N := 400;
    order := 4;
    char_gens := [351, 101, 177];
    char_values := [[-1, 0, 0, 0, 0, 0, 0, 0, 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, 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 := true, 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+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 := 6;
    raw_aps := [[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, 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, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, -1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0], [-40, -1, 0, 0, 40, 0, 0, 0, -2, 1, 1, -1, 0, 0, 0, 0, 0, 0, 1, 0], [112, -1, 0, 0, 112, 0, 0, 4, 0, 5, -2, 0, 1, 0, 0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 0, -2, -2, -3, -3, -1, 0, -1], [0, 0, 3, 1, 0, 0, -59, 0, 0, 0, 0, 0, 0, 0, 1, 0, -5, -3, 0, 1], [0, 19, 0, 0, 960, 0, 0, -16, 19, -19, 0, 10, 10, 0, 0, 0, 0, 0, -2, 0], [0, 0, -8, -1, 0, -96, -96, 0, 0, 0, 0, 0, 0, 4, -4, -23, 23, 0, 0, 0], [-2209, -18, 0, 0, -2209, 0, 0, -25, 0, -7, 14, 0, 20, 0, 0, 0, 0, 0, -14, 0], [-324, -26, 0, 0, 0, 0, 0, 0, -9, -20, -11, -35, 35, 0, 0, 0, 0, 0, 0, 0], [0, 0, -8, -1, 0, 0, -323, 0, 0, 0, 0, 0, 0, 0, -36, 0, -10, 8, 0, -1], [0, 0, -19, 2, 0, -97, 0, 0, 0, 0, 0, 0, 0, 23, 0, 11, 0, -19, 0, -2], [-9114, -42, 0, 0, 9114, 0, 0, 17, 50, 25, 25, -43, 0, 0, 0, 0, 0, 0, 25, 0], [0, 0, 0, 0, 0, -59, 59, 0, 0, 0, 0, 0, 0, -42, -42, 59, 59, 15, 0, 11], [-2044, 72, 0, 0, 0, 0, 0, 0, -55, -47, 8, -25, 25, 0, 0, 0, 0, 0, 0, 0], [0, 0, -26, 8, 0, 1099, 0, 0, 0, 0, 0, 0, 0, 92, 0, -14, 0, -26, 0, -8], [0, 0, 40, 5, 0, 530, 530, 0, 0, 0, 0, 0, 0, 67, -67, 5, -5, 0, 0, 0], [-13230, -143, 0, 0, 13230, 0, 0, 182, -229, -39, -39, 57, 0, 0, 0, 0, 0, 0, -39, 0], [0, 0, 0, 0, 0, -163, 163, 0, 0, 0, 0, 0, 0, -166, -166, -224, -224, -24, 0, 3], [0, 0, 9, 8, 0, 0, 163, 0, 0, 0, 0, 0, 0, 0, -372, 0, -416, -9, 0, 8], [0, 128, 0, 0, 28740, 0, 0, -182, 128, -128, 0, -130, -130, 0, 0, 0, 0, 0, -46, 0], [-18762, 218, 0, 0, -18762, 0, 0, 634, 0, 416, 99, 0, -117, 0, 0, 0, 0, 0, -99, 0], [-25814, 220, 0, 0, 0, 0, 0, 0, -306, -264, 42, 210, -210, 0, 0, 0, 0, 0, 0, 0], [0, 0, -11, 38, 0, 0, 4295, 0, 0, 0, 0, 0, 0, 0, -637, 0, 39, 11, 0, 38], [0, 0, 48, -19, 0, 2757, 0, 0, 0, 0, 0, 0, 0, 584, 0, 744, 0, 48, 0, 19], [0, 88, 0, 0, 47786, 0, 0, 433, 88, -88, 0, -155, -155, 0, 0, 0, 0, 0, -194, 0], [-63473, -67, 0, 0, 63473, 0, 0, -38, -428, 105, 105, 156, 0, 0, 0, 0, 0, 0, 105, 0], [0, 0, 24, 48, 0, -3417, 0, 0, 0, 0, 0, 0, 0, 542, 0, 867, 0, 24, 0, -48], [0, 0, 1, 47, 0, -3488, -3488, 0, 0, 0, 0, 0, 0, 312, -312, 501, -501, 0, 0, 0], [-11313, 376, 0, 0, -11313, 0, 0, -402, 0, -778, -80, 0, -56, 0, 0, 0, 0, 0, 80, 0], [0, 0, 0, 0, 0, 6702, -6702, 0, 0, 0, 0, 0, 0, -512, -512, -557, -557, -305, 0, 82], [0, -873, 0, 0, 7148, 0, 0, 777, -873, 873, 0, 130, 130, 0, 0, 0, 0, 0, -242, 0], [0, 0, 516, -84, 0, -5327, -5327, 0, 0, 0, 0, 0, 0, 511, -511, 1025, -1025, 0, 0, 0], [-43409, 839, 0, 0, -43409, 0, 0, 148, 0, -691, -264, 0, 264, 0, 0, 0, 0, 0, 264, 0], [0, 0, -688, 4, 0, 0, -3513, 0, 0, 0, 0, 0, 0, 0, -1146, 0, 296, 688, 0, 4], [0, 0, -341, -22, 0, -8913, 0, 0, 0, 0, 0, 0, 0, 847, 0, -1339, 0, -341, 0, 22], [-23059, -1429, 0, 0, 23059, 0, 0, 1091, -1475, 338, 338, -1190, 0, 0, 0, 0, 0, 0, 338, 0], [0, 0, 0, 0, 0, 7750, -7750, 0, 0, 0, 0, 0, 0, -254, -254, -867, -867, 721, 0, 26], [-156580, -1131, 0, 0, 0, 0, 0, 0, 1161, 1105, -56, -935, 935, 0, 0, 0, 0, 0, 0, 0], [0, 0, -688, 132, 0, 6141, 6141, 0, 0, 0, 0, 0, 0, -34, 34, 1325, -1325, 0, 0, 0], [4026, 360, 0, 0, -4026, 0, 0, 166, -1047, -526, -526, -851, 0, 0, 0, 0, 0, 0, -526, 0], [-169958, 308, 0, 0, -169958, 0, 0, -403, 0, -711, 637, 0, 67, 0, 0, 0, 0, 0, -637, 0], [0, 0, 0, 0, 0, -3021, 3021, 0, 0, 0, 0, 0, 0, -86, -86, -138, -138, -1458, 0, -99], [0, 0, -605, -313, 0, -3772, -3772, 0, 0, 0, 0, 0, 0, 58, -58, -1063, 1063, 0, 0, 0], [0, 0, -380, 245, 0, 0, 21201, 0, 0, 0, 0, 0, 0, 0, 2540, 0, 3229, 380, 0, 245], [0, 0, 227, -171, 0, 18553, 0, 0, 0, 0, 0, 0, 0, -334, 0, 1470, 0, 227, 0, 171], [0, 784, 0, 0, -323986, 0, 0, -3456, 784, -784, 0, -1615, -1615, 0, 0, 0, 0, 0, 368, 0], [43774, 4258, 0, 0, -43774, 0, 0, -3760, 6159, -498, -498, 1209, 0, 0, 0, 0, 0, 0, -498, 0], [0, 0, 0, 0, 0, 10025, -10025, 0, 0, 0, 0, 0, 0, 1545, 1545, 1436, 1436, 802, 0, -213], [395132, -714, 0, 0, 0, 0, 0, 0, -549, -732, -183, 1065, -1065, 0, 0, 0, 0, 0, 0, 0], [0, 0, -63, 146, 0, 2047, 2047, 0, 0, 0, 0, 0, 0, -1138, 1138, -211, 211, 0, 0, 0], [204223, -4815, 0, 0, 204223, 0, 0, 1850, 0, 6665, 1361, 0, -1516, 0, 0, 0, 0, 0, -1361, 0], [0, 0, 22, -176, 0, 0, -4145, 0, 0, 0, 0, 0, 0, 0, 5324, 0, -2869, -22, 0, -176], [0, -2634, 0, 0, -395210, 0, 0, 4281, -2634, 2634, 0, -2785, -2785, 0, 0, 0, 0, 0, 3296, 0], [0, 0, 2750, -473, 0, 1708, 1708, 0, 0, 0, 0, 0, 0, -1199, 1199, -4403, 4403, 0, 0, 0], [-120921, 4831, 0, 0, -120921, 0, 0, 1100, 0, -3731, 1014, 0, -3432, 0, 0, 0, 0, 0, -1014, 0], [849252, 6878, 0, 0, 0, 0, 0, 0, 259, 818, 559, 385, -385, 0, 0, 0, 0, 0, 0, 0], [0, 0, -1459, -143, 0, 0, 18181, 0, 0, 0, 0, 0, 0, 0, 5722, 0, 4158, 1459, 0, -143], [674029, -3950, 0, 0, -674029, 0, 0, 4444, 1307, -494, -494, -34, 0, 0, 0, 0, 0, 0, -494, 0], [0, 0, -794, 407, 0, 5897, 0, 0, 0, 0, 0, 0, 0, -6852, 0, 4158, 0, -794, 0, -407], [0, 0, 1250, 156, 0, -54851, -54851, 0, 0, 0, 0, 0, 0, -1560, 1560, -2339, 2339, 0, 0, 0], [-333007, -9515, 0, 0, 333007, 0, 0, 7396, -2548, 2119, 2119, -478, 0, 0, 0, 0, 0, 0, 2119, 0], [-310798, -723, 0, 0, -310798, 0, 0, 4322, 0, 5045, -3449, 0, -1889, 0, 0, 0, 0, 0, 3449, 0], [0, 0, -749, -205, 0, -35996, -35996, 0, 0, 0, 0, 0, 0, -2704, 2704, 2829, -2829, 0, 0, 0], [966053, -1812, 0, 0, 966053, 0, 0, 7176, 0, 8988, 2334, 0, -1794, 0, 0, 0, 0, 0, -2334, 0], [0, 0, 955, -235, 0, -83647, 0, 0, 0, 0, 0, 0, 0, 690, 0, 5424, 0, 955, 0, 235], [0, 10778, 0, 0, -749610, 0, 0, -2412, 10778, -10778, 0, 745, 745, 0, 0, 0, 0, 0, -3752, 0], [-68401, -6652, 0, 0, 68401, 0, 0, 4110, -16456, 2542, 2542, -7696, 0, 0, 0, 0, 0, 0, 2542, 0], [0, 0, 0, 0, 0, 36106, -36106, 0, 0, 0, 0, 0, 0, 2609, 2609, -10810, -10810, 132, 0, -422], [0, 0, 2004, -492, 0, 32367, 0, 0, 0, 0, 0, 0, 0, -2418, 0, -1641, 0, 2004, 0, 492], [809503, -1213, 0, 0, -809503, 0, 0, 2807, 277, -1594, -1594, -10016, 0, 0, 0, 0, 0, 0, -1594, 0], [0, 0, 0, 0, 0, -80334, 80334, 0, 0, 0, 0, 0, 0, -1266, -1266, -5029, -5029, 3389, 0, -670], [0, 0, 684, 633, 0, 0, -5063, 0, 0, 0, 0, 0, 0, 0, 5528, 0, 4213, -684, 0, 633], [0, -14602, 0, 0, -770022, 0, 0, 18523, -14602, 14602, 0, -2455, -2455, 0, 0, 0, 0, 0, 4832, 0], [-1583616, -15416, 0, 0, -1583616, 0, 0, 10847, 0, 26263, -1053, 0, 9, 0, 0, 0, 0, 0, 1053, 0], [380908, -19913, 0, 0, 0, 0, 0, 0, -1521, -4041, -2520, -3465, 3465, 0, 0, 0, 0, 0, 0, 0], [0, -12431, 0, 0, 435334, 0, 0, 8594, -12431, 12431, 0, -2115, -2115, 0, 0, 0, 0, 0, -2955, 0], [0, 0, 0, 0, 0, 26546, -26546, 0, 0, 0, 0, 0, 0, -2162, -2162, -2859, -2859, -3601, 0, -30], [-1599362, 5043, 0, 0, 0, 0, 0, 0, -15700, -10458, 5242, -2150, 2150, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1274, 107, 0, 7704, 7704, 0, 0, 0, 0, 0, 0, 6357, -6357, 13733, -13733, 0, 0, 0], [-1617526, 8911, 0, 0, 1617526, 0, 0, -3038, 4877, -5873, -5873, 8177, 0, 0, 0, 0, 0, 0, -5873, 0], [0, 0, 0, 0, 0, 33080, -33080, 0, 0, 0, 0, 0, 0, -5895, -5895, 12362, 12362, 2284, 0, 484], [0, 0, -3055, -525, 0, 0, 1017, 0, 0, 0, 0, 0, 0, 0, -8560, 0, 23942, 3055, 0, -525], [0, 1996, 0, 0, 2071824, 0, 0, 2906, 1996, -1996, 0, -5810, -5810, 0, 0, 0, 0, 0, 877, 0], [1749907, 14773, 0, 0, 1749907, 0, 0, -25728, 0, -40501, 6817, 0, 3232, 0, 0, 0, 0, 0, -6817, 0], [-2949194, 9818, 0, 0, 0, 0, 0, 0, 9812, 7510, -2302, 5480, -5480, 0, 0, 0, 0, 0, 0, 0], [0, 0, 4963, -1534, 0, 0, 74151, 0, 0, 0, 0, 0, 0, 0, -25679, 0, -6467, -4963, 0, -1534], [0, 0, -1375, 1310, 0, 136611, 0, 0, 0, 0, 0, 0, 0, 18300, 0, -6350, 0, -1375, 0, -1310], [0, 0, 0, 0, 0, 131528, -131528, 0, 0, 0, 0, 0, 0, -3549, -3549, -8492, -8492, 1902, 0, 1780], [0, 0, -7086, -627, 0, 141905, 0, 0, 0, 0, 0, 0, 0, 8262, 0, 4153, 0, -7086, 0, 627], [0, 0, 1007, 311, 0, -16688, -16688, 0, 0, 0, 0, 0, 0, 14080, -14080, -251, 251, 0, 0, 0], [0, 0, 0, 0, 0, 88936, -88936, 0, 0, 0, 0, 0, 0, -11996, -11996, 8129, 8129, 6915, 0, 156], [0, 0, -9211, 668, 0, 0, -52045, 0, 0, 0, 0, 0, 0, 0, -11087, 0, -36653, 9211, 0, 668], [0, 6358, 0, 0, -1540322, 0, 0, -6432, 6358, -6358, 0, -7955, -7955, 0, 0, 0, 0, 0, -6068, 0], [-515302, -3370, 0, 0, 0, 0, 0, 0, 6784, 13086, 6302, 4460, -4460, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1971, -108, 0, 0, -245709, 0, 0, 0, 0, 0, 0, 0, -30218, 0, -20094, -1971, 0, -108], [-3244766, -29148, 0, 0, 0, 0, 0, 0, -20162, -17920, 2242, 370, -370, 0, 0, 0, 0, 0, 0, 0], [0, 0, -2225, -2905, 0, 27885, 0, 0, 0, 0, 0, 0, 0, 12150, 0, -9682, 0, -2225, 0, 2905], [-4634415, 7230, 0, 0, -4634415, 0, 0, -1049, 0, -8279, 6450, 0, 18294, 0, 0, 0, 0, 0, -6450, 0], [0, 0, 3966, 1922, 0, 0, 248667, 0, 0, 0, 0, 0, 0, 0, 622, 0, -19428, -3966, 0, 1922], [0, 1255, 0, 0, 2386306, 0, 0, 15330, 1255, -1255, 0, 2575, 2575, 0, 0, 0, 0, 0, 655, 0], [0, 0, -14301, 2376, 0, -156295, -156295, 0, 0, 0, 0, 0, 0, -1108, 1108, 9217, -9217, 0, 0, 0], [1948469, -28131, 0, 0, 1948469, 0, 0, -9802, 0, 18329, -8833, 0, -17422, 0, 0, 0, 0, 0, 8833, 0], [0, 0, 3115, 1400, 0, 57703, 0, 0, 0, 0, 0, 0, 0, 32270, 0, 52156, 0, 3115, 0, -1400], [-2758597, -29400, 0, 0, 2758597, 0, 0, 14672, -42792, 14728, 14728, -21868, 0, 0, 0, 0, 0, 0, 14728, 0], [0, 0, 0, 0, 0, -213911, 213911, 0, 0, 0, 0, 0, 0, 5116, 5116, -18950, -18950, -2002, 0, -1553], [5272808, 18876, 0, 0, 0, 0, 0, 0, -31575, -28556, 3019, -11225, 11225, 0, 0, 0, 0, 0, 0, 0], [0, 0, 653, -554, 0, -281193, 0, 0, 0, 0, 0, 0, 0, -10951, 0, 12271, 0, 653, 0, 554], [-449648, 253, 0, 0, 449648, 0, 0, -8940, -16180, 8687, 8687, 3751, 0, 0, 0, 0, 0, 0, 8687, 0], [-408696, -26901, 0, 0, -408696, 0, 0, -5522, 0, 21379, 7122, 0, 17073, 0, 0, 0, 0, 0, -7122, 0], [0, 0, 0, 0, 0, -118975, 118975, 0, 0, 0, 0, 0, 0, -12016, -12016, -209, -209, 15207, 0, -633], [0, 0, 2074, 4028, 0, -175187, -175187, 0, 0, 0, 0, 0, 0, -21404, 21404, -32931, 32931, 0, 0, 0], [-1207808, -18644, 0, 0, 0, 0, 0, 0, -49191, -29910, 19281, -19065, 19065, 0, 0, 0, 0, 0, 0, 0], [0, 0, -8489, -358, 0, 0, 51935, 0, 0, 0, 0, 0, 0, 0, -4338, 0, -40548, 8489, 0, -358], [0, 0, -9530, 285, 0, -538911, 0, 0, 0, 0, 0, 0, 0, 32660, 0, 785, 0, -9530, 0, -285], [4778356, -76666, 0, 0, -4778356, 0, 0, 68057, -73438, 8609, 8609, -24017, 0, 0, 0, 0, 0, 0, 8609, 0], [0, 0, 0, 0, 0, 114818, -114818, 0, 0, 0, 0, 0, 0, 21878, 21878, 79113, 79113, 11687, 0, 1930], [1995582, 5727, 0, 0, 0, 0, 0, 0, 5260, -32712, -37972, 1250, -1250, 0, 0, 0, 0, 0, 0, 0], [-3890154, -13389, 0, 0, 3890154, 0, 0, 14884, 57453, -1495, -1495, -36875, 0, 0, 0, 0, 0, 0, -1495, 0], [-4798846, 35624, 0, 0, -4798846, 0, 0, 2871, 0, -32753, 15747, 0, -27765, 0, 0, 0, 0, 0, -15747, 0], [0, 0, -4564, -1483, 0, 0, -50727, 0, 0, 0, 0, 0, 0, 0, 55362, 0, -35194, 4564, 0, -1483], [0, 0, 24271, -2419, 0, 39778, 39778, 0, 0, 0, 0, 0, 0, -15494, 15494, -33975, 33975, 0, 0, 0], [-3502104, 32122, 0, 0, 0, 0, 0, 0, 10807, 38521, 27714, 4605, -4605, 0, 0, 0, 0, 0, 0, 0], [0, 37363, 0, 0, 2253932, 0, 0, -44752, 37363, -37363, 0, 420, 420, 0, 0, 0, 0, 0, 16830, 0], [0, 0, 0, 0, 0, -140911, 140911, 0, 0, 0, 0, 0, 0, 35269, 35269, -40332, -40332, -5806, 0, 3123], [0, 0, 5676, 2667, 0, -32507, 0, 0, 0, 0, 0, 0, 0, -68542, 0, 36005, 0, 5676, 0, -2667], [4667711, 45385, 0, 0, -4667711, 0, 0, -47109, 22223, 1724, 1724, 56464, 0, 0, 0, 0, 0, 0, 1724, 0], [0, 0, 0, 0, 0, 520580, -520580, 0, 0, 0, 0, 0, 0, 26668, 26668, -13927, -13927, 721, 0, -44], [0, 0, 27908, -1839, 0, 0, -371751, 0, 0, 0, 0, 0, 0, 0, 86336, 0, 5507, -27908, 0, -1839], [0, 0, -3480, -4188, 0, 455253, 455253, 0, 0, 0, 0, 0, 0, -25234, 25234, 7317, -7317, 0, 0, 0], [2264205, -49949, 0, 0, 2264205, 0, 0, 5632, 0, 55581, -13924, 0, 57254, 0, 0, 0, 0, 0, 13924, 0], [-434560, -43231, 0, 0, 0, 0, 0, 0, -35295, -30519, 4776, 27225, -27225, 0, 0, 0, 0, 0, 0, 0], [0, -26557, 0, 0, -1916290, 0, 0, -27332, -26557, 26557, 0, 4995, 4995, 0, 0, 0, 0, 0, -9366, 0], [1521068, -27163, 0, 0, -1521068, 0, 0, -15846, -7336, 43009, 43009, -34021, 0, 0, 0, 0, 0, 0, 43009, 0], [0, 0, 5564, -542, 0, 541639, 0, 0, 0, 0, 0, 0, 0, -72888, 0, 43062, 0, 5564, 0, 542], [1474896, 6705, 0, 0, 1474896, 0, 0, -56274, 0, -62979, -13683, 0, 42117, 0, 0, 0, 0, 0, 13683, 0], [0, 65608, 0, 0, -4703044, 0, 0, -67032, 65608, -65608, 0, -21630, -21630, 0, 0, 0, 0, 0, 31128, 0], [0, 0, -19287, -6390, 0, 93327, 93327, 0, 0, 0, 0, 0, 0, -41716, 41716, 72597, -72597, 0, 0, 0], [-6077072, 8558, 0, 0, 0, 0, 0, 0, -29665, -15983, 13682, 19325, -19325, 0, 0, 0, 0, 0, 0, 0], [0, 0, -5361, 3228, 0, 0, -862469, 0, 0, 0, 0, 0, 0, 0, 40913, 0, -27221, 5361, 0, 3228], [0, 0, -6841, -7847, 0, 195289, 0, 0, 0, 0, 0, 0, 0, 78222, 0, -63672, 0, -6841, 0, 7847], [0, 28562, 0, 0, 1263510, 0, 0, 1197, 28562, -28562, 0, 20455, 20455, 0, 0, 0, 0, 0, 21508, 0], [0, 0, 0, 0, 0, -497494, 497494, 0, 0, 0, 0, 0, 0, 70210, 70210, -8782, -8782, -8162, 0, 814], [1512828, 74657, 0, 0, -1512828, 0, 0, -36170, -38420, -38487, -38487, -3381, 0, 0, 0, 0, 0, 0, -38487, 0], [-5323241, -53092, 0, 0, -5323241, 0, 0, -86600, 0, -33508, -19694, 0, 100960, 0, 0, 0, 0, 0, 19694, 0], [0, 0, 0, 0, 0, 129599, -129599, 0, 0, 0, 0, 0, 0, -7618, -7618, -9381, -9381, -62209, 0, -1135], [0, 0, -3411, -977, 0, 0, 457945, 0, 0, 0, 0, 0, 0, 0, 97963, 0, -8327, 3411, 0, -977], [7172551, -9941, 0, 0, 7172551, 0, 0, 45582, 0, 55523, 26266, 0, -50960, 0, 0, 0, 0, 0, -26266, 0], [-11859720, 4268, 0, 0, 0, 0, 0, 0, 110445, 94952, -15493, 13475, -13475, 0, 0, 0, 0, 0, 0, 0], [0, 0, 12978, -2214, 0, 0, 980507, 0, 0, 0, 0, 0, 0, 0, -16724, 0, 41516, -12978, 0, -2214], [0, 0, 30546, -753, 0, 99429, 0, 0, 0, 0, 0, 0, 0, 91818, 0, -76731, 0, 30546, 0, 753], [0, 0, -8212, 4756, 0, -876749, 0, 0, 0, 0, 0, 0, 0, -68946, 0, -34296, 0, -8212, 0, -4756], [0, 0, 30848, 16099, 0, -87652, -87652, 0, 0, 0, 0, 0, 0, 12636, -12636, 38961, -38961, 0, 0, 0], [0, 0, 0, 0, 0, -65175, 65175, 0, 0, 0, 0, 0, 0, -30772, -30772, -46430, -46430, -30590, 0, 10135], [0, -47802, 0, 0, -1870316, 0, 0, -47942, -47802, 47802, 0, 21420, 21420, 0, 0, 0, 0, 0, 18747, 0], [8234438, 197463, 0, 0, 8234438, 0, 0, 66690, 0, -130773, -8976, 0, 3447, 0, 0, 0, 0, 0, 8976, 0], [5158808, 133291, 0, 0, 0, 0, 0, 0, -14577, -40009, -25432, -8305, 8305, 0, 0, 0, 0, 0, 0, 0], [0, 0, -22754, 4307, 0, -350303, 0, 0, 0, 0, 0, 0, 0, 139418, 0, -30866, 0, -22754, 0, -4307], [10123275, 123031, 0, 0, -10123275, 0, 0, -132696, 161306, 9665, 9665, -59984, 0, 0, 0, 0, 0, 0, 9665, 0], [0, 0, -46427, 311, 0, -370207, 0, 0, 0, 0, 0, 0, 0, -44241, 0, 136317, 0, -46427, 0, -311], [0, 0, 1925, 1365, 0, -3990, -3990, 0, 0, 0, 0, 0, 0, 111494, -111494, 150785, -150785, 0, 0, 0], [-20994274, 13398, 0, 0, -20994274, 0, 0, 134664, 0, 121266, -43895, 0, -110813, 0, 0, 0, 0, 0, 43895, 0], [0, 0, 4572, -8286, 0, 0, -528981, 0, 0, 0, 0, 0, 0, 0, -2826, 0, -103521, -4572, 0, -8286], [0, 0, -15090, -4764, 0, -1035591, -1035591, 0, 0, 0, 0, 0, 0, 15371, -15371, 38841, -38841, 0, 0, 0], [1985364, -76139, 0, 0, 1985364, 0, 0, 12388, 0, 88527, 24989, 0, 118145, 0, 0, 0, 0, 0, -24989, 0]];
    aps := ConvertToHeckeField(raw_aps);
    chi := MakeCharacter_400_n_Hecke(Universe(aps));
    return ExtendMultiplicatively(weight, aps, chi);
end function;


// To make the newform (type ModFrm), type "MakeNewformModFrm_400_6_n_g();".
// 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_400_6_n_g(:prec:=20)
    chi := MakeCharacter_400_n();
    f_vec := qexpCoeffs();
    Kf := Universe(f_vec);
    // SetVerbose("ModularForms", true);
    // SetVerbose("ModularSymbols", true);
    S := CuspidalSubspace(ModularForms(chi, 6));
    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_400_6_n_g();".
// 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_400_6_n_g( : sign := -1)
    R<x> := PolynomialRing(Rationals());
    chi := MakeCharacter_400_n();
    // SetVerbose("ModularSymbols", true);
    Snew := NewSubspace(CuspidalSubspace(ModularSymbols(chi,6,sign)));
    Vf := Kernel([<3,R![216763542247808434176, 0, 0, 0, 108964362492176302080, 0, 0, 0, 12246534533136960, 0, 0, 0, 297452922160, 0, 0, 0, 1095980, 0, 0, 0, 1]>],Snew);
    return Vf;
end function;