#agc040a. [agc040_a]><

[agc040_a]><

Problem Statement

Given is a string SS of length N1N-1. Each character in SS is < or >.

A sequence of NN non-negative integers, a1,a2,cdots,aNa_1,a_2,\\cdots,a_N, is said to be good when the following condition is satisfied for all ii (1leqileqN11 \\leq i \\leq N-1):

  • If Si=S_i= <: ai<ai+1a_i<a_{i+1}
  • If Si=S_i= >: ai>ai+1a_i>a_{i+1}

Find the minimum possible sum of the elements of a good sequence of NN non-negative integers.

Constraints

  • 2leqNleq5times1052 \\leq N \\leq 5 \\times 10^5
  • SS is a string of length N1N-1 consisting of < and >.

Input

Input is given from Standard Input in the following format:

SS

Output

Find the minimum possible sum of the elements of a good sequence of NN non-negative integers.


Sample Input 1

<>>

Sample Output 1

3

a=(0,2,1,0)a=(0,2,1,0) is a good sequence whose sum is 33. There is no good sequence whose sum is less than 33.


Sample Input 2

<>>><<><<<<<>>><

Sample Output 2

28