import time


def frecency(rank, last_time):
    """Calculate 'frecency' from rank and last access time."""
    delta_t = time.time() - last_time
    multiplier = 0
    if delta_t < 3600:
        multiplier = 4
    elif delta_t < 86400:
        multiplier = 2
    elif delta_t < 604800:
        multiplier = 0.5
    else:
        multiplier = 0.25

    return rank * multiplier