import sys
from io import StringIO
import unittest
import math

# 参考1：余弦定理(この頁を学習すると、|??|に入る式が分かり、直角三角形でない場合でも第3の辺aの長さを求めることができるようになります。)
# https://www.geisya.or.jp/~mwm48961/kou2/cos_rule.htm
# aの2乗 = bの2乗 + cの2乗 − 2bccosA
# 参考2：コサイン等の関数説明
# https://note.nkmk.me/python-math-sin-cos-tan/

def resolve():
    a, b, h, m = map(int, input().split())

    # 角度を求める
    hour_degrees = h*30 + m*0.5
    minutes_degrees = m*6

    # 角度が同じなら、単に辺の差を出力して終了
    if hour_degrees is minutes_degrees:
        print(abs(a - b))
        return

    # 角度が180度なら、単に辺の和を出力して終了
    if abs(hour_degrees - minutes_degrees) is 180.0:
        print(abs(a + b))
        return


    # 角度と長さを取得
    if hour_degrees > minutes_degrees:
        big = [hour_degrees, a]
        sho = [minutes_degrees, b]
    else:
        big = [minutes_degrees, b]
        sho = [hour_degrees, a]

    # 長さを求める辺をAとして・・
    # 2辺(BとC)が180度以上開いていない場合：角度の小さい辺がAの右辺 深い辺がAの左辺。
    if big[0] - sho[0] < 180:
        a_right = sho
        a_left = big
        degrees = big[0] - sho[0]
    # 2辺(BとC)が180度以上開いている場合　　：角度の小さい辺がAの右辺 深い辺がAの左辺。
    else:
        a_right = big
        a_left = sho
        degrees = big[0] - sho[0] - 180

    # 余弦定理にて辺aの長さを求める
    # aの2乗 = bの2乗 + cの2乗 − 2bccosA
    a2 = pow(a_right[1], 2) + pow(a_left[1], 2) - 2 * a_right[1] * a_left[1] * math.cos(math.radians(degrees))

    # 平方根を出力
    print(math.sqrt(a2))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3 4 9 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """3 4 10 40"""
        output = """4.56425719433005567605"""
        self.assertIO(input, output)
    # 以下、自作したテストパターン
    def test_入力例_3(self):
        input = """3 4 3 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """3 4 4 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_5(self):
        input = """3 4 5 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_6(self):
        input = """3 4 6 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_7(self):
        input = """3 4 7 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_8(self):
        input = """3 4 8 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_9(self):
        input = """3 4 9 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_10(self):
        input = """3 4 10 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_11(self):
        input = """3 4 11 0"""
        output = """5.00000000000000000000"""
        self.assertIO(input, output)
    def test_入力例_0(self):
        input = """3 4 0 0"""
        output = """1.00000000000000000000"""
        self.assertIO(input, output)

#
#4 6.082762530298219
#5 6.766432567522307
#6 5.0
#7 2.0531415706603067
#8 3.6055512754639887
#9 5.0
#10 6.082762530298219
#11 6.766432567522307


if __name__ == "__main__":
    # unittest.main()
    resolve()

### FIXED CODE ###

import sys
from io import StringIO
import unittest

def resolve():
    n = input()

    target = n[-1]

    if target in ("2","4","5","7","9"):
        print("hon")
    elif target in ("0","1","6","8"):
        print("pon")
    else:
        print("bon")


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """16"""
        output = """pon"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """2"""
        output = """hon"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """183"""
        output = """bon"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()