Inclusion Criteria:  Age 22-65 year old at the time of screening on voluntary or involuntary hold Able to read, understand, and provide written, dated informed consent prior to screening. Participants will be deemed likely to comply with study protocol and communicate with study personnel about adverse events and other clinically important information.  Diagnosed with Major Depressive Disorder (MDD) or Bipolar Affective Disorder II (BAPD II), according to the criteria defined in the Diagnosis and Statistical Manual of Mental Disorders, Fifth Edition, Text Revision (DSM-5).  Endorse suicidal ideation (score ≥9 on the SSI-M).  Meet the threshold on the MADRS and HAMD-17 with a total score of >/=20 at baseline. Not in a current state of mania (Young Mania Rating Scale) or psychosis (MINI) Have to be TMS naive In good general health, as ascertained by medical history. Scheduled with a psychiatrist Access to clinical rTMS after hospital discharge If participant is of childbearing potential and not already pregnant, must agree to use adequate contraception prior to study and for the duration of study participation. No recent use (for the actual depressive episode) of rapid acting antidepressive agent (ketamine)  Exclusion Criteria:  Any abnormalities indicated on previous MRI scans e.g. structural neurological condition, more subcortical lesions than would be expected for age, stroke affecting stimulated area or connected areas or any other clinically significant abnormality that might affect safety, study participation, or confound interpretation of study results. Metal implant in brain (e.g. deep brain stimulation), cardiac pacemaker, or cochlear History of epilepsy/ seizures (including history of withdrawal/ provoked seizures) Shrapnel or any ferromagnetic item in the head. Pregnancy: The effects of rTMS on the developing human fetus are incipient and still uncertain (25). We will not be enrolling pregnant women to this study. Women of childbearing potential must agree to use adequate contraception (hormonal / barrier method of birth control or abstinence) prior to study entry and for the duration of study participation. Females of childbearing-age, will have a pregnancy test prior to receiving each rTMS stimulation session. Should a woman become pregnant or suspects she is pregnant while participating in this study, she should inform study staff. Autism Spectrum disorder A diagnosis of obsessive-compulsive disorder (OCD) The presence or diagnosis of prominent anxiety disorder, personality disorder, or dysthymia Any current or past history of any physical condition which in the investigator's opinion might put the subject at risk or interfere with study results interpretation. Active substance use (<1 week) or intoxication verified by toxicology screen--of cocaine, amphetamines, benzodiazepines Cognitive impairment (including dementia) Current severe insomnia (must sleep a minimum of 5 hours the night before stimulation) Current mania or psychosis Bipolar Affective Disorder I and primary psychotic disorders. Showing symptoms of withdrawal from alcohol or benzodiazepines IQ<70 Parkinsonism or other movement d/o determined by PI to interfere with treatment Desirous of getting ECT and previous intolerant exposure to ECT Any other indication the PI feels would comprise data No access to clinical rTMS after discharge. Previous TMS exposure. Depth-adjusted aiTBS treatment dose > 65% maximum stimulator output (MSO).