package main
import (
"fmt"
"strconv"
"strings"
)
func strToInt(str string) int {
v, _ := strconv.Atoi(str)
return v
}
func main() {
for {
var input string
fmt.Scan(&input)
if len(input) == 0 {
break
}
arr0 := strings.Split(input, ".")
// fmt.Printf("%#v\n", arr0)
if len(arr0) == 4 { // ip
val := (strToInt(arr0[0]) << (8 * 3)) +
(strToInt(arr0[1]) << (8 * 2)) +
(strToInt(arr0[2]) << (8 * 1)) +
(strToInt(arr0[3]))
fmt.Printf("%v\n", val)
} else { // number
rawVal := strToInt(input)
fmt.Printf("%v.%v.%v.%v",
(rawVal >> (8 * 3) & 255),
(rawVal >> (8 * 2) & 255),
(rawVal >> (8 * 1) & 255),
(rawVal & 255),
)
}
}
}