Ruler equation for precisely tailoring the resonance frequency of terahertz U-shaped metamaterials