import re


def convert_to_seconds(duration_str) -> int:
    """
    for (s)econds, (m)inutes, (h)ours, (d)ays, (w)eeks
    return duration in seconds
    """

    seconds = 0
    if re.match(r"[0-9]+$", duration_str):
        seconds = int(duration_str)
    elif re.match(r"[0-9]+s$", duration_str):
        seconds = int(duration_str[:-1])
    elif re.match(r"[0-9]+m$", duration_str):
        seconds = 60 * int(duration_str[:-1])
    elif re.match(r"[0-9]+h$", duration_str):
        seconds = 3600 * int(duration_str[:-1])
    elif re.match(r"[0-9]+d$", duration_str):
        seconds = 86400 * int(duration_str[:-1])
    elif re.match(r"[0-9]+w$", duration_str):
        seconds = 7 * 86400 * int(duration_str[:-1])

    return seconds